home *** CD-ROM | disk | FTP | other *** search
/ 500 MB Nyheder Direkte fra Internet 2 / 500 MB nyheder direkte fra internet CD 2.iso / start / data / text / versions.txt < prev    next >
Text File  |  1994-09-21  |  168KB  |  3,527 lines

  1.  
  2.                  IBM PC & CLONES
  3.   Here's how to use BASIC on the IBM PC. (The IBM PC Junior, IBM 
  4. PC XT, IBM PC AT, IBM PS/1, IBM PS/2, and IBM Valuepoint are 
  5. similar. So are the microcomputers that are called 
  6. ``IBM-compatible'' or ``IBM clones''.)
  7.  
  8.              The keyboard (page 324)
  9.   The original IBM PC contained 83 keys, placed like this:
  10. ┌───┬───┐  ┌─────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───
  11. ┬────────┬─────────┬──────────┐
  12. │   │   │  │     │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + 
  13. │        │         │          │
  14. │F1 │F2 │  │Esc  │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = 
  15. │ Backsp │ NumLock │ScrollLock│
  16. ├───┼───┤  ├─────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─
  17. ┴──┬─────┼────┬────┼────┬─────┤
  18. │   │   │  │LeftTab│ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ 
  19. }  │     │ 7  │ 8  │ 9  │     │
  20. │F3 │F4 │  │Tab    │   │   │   │   │   │   │   │   │   │   │ [ │ 
  21. ]  │     │Home│   │PgUp│  -  │
  22. ├───┼───┤  ├───────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬
  23. ───┤     ├────┼────┼────┼─────┤
  24. │   │   │  │        │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │ 
  25. ~ │     │ 4  │ 5  │ 6  │     │
  26. │F5 │F6 │  │Ctrl    │   │   │   │   │   │   │   │   │   │ ; │ ' │ 
  27. ` │Enter│   │    │ ■  │     │
  28. ├───┼───┤  ├──────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴
  29. ───┼─────┼────┼────┼────┤     │
  30. │   │   │  │      │ | │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │     
  31. │PrtSc│ 1  │ 2  │ 3  │     │
  32. │F7 │F8 │  │Shift │ \ │   │   │   │   │   │   │   │ , │ . │ / 
  33. │Shift│  *  │End │   │PgDn│     │
  34. ├───┼───┤  ├──────┴──┬┴───┴───┴───┴───┴───┴───┴───┴───┴───┴┬──┴──
  35. ───┼─────┴────┼────┴────┤     │
  36. │   │   │  │         │                                     │        
  37. │    0     │    .    │     │
  38. │F9 │F10│  │Alt      │                Space                
  39. │CapsLock│   Ins    │   Del   │  +  │
  40. └───┴───┘  └─────────┴─────────────────────────────────────┴─────
  41. ───┴──────────┴─────────┴─────┘
  42. In that diagram, I wrote the words ``Shift'', ``Backsp'', 
  43. ``Tab'', and ``Enter''; but if you look at the actual IBM PC 
  44. keyboard, you'll see arrows on those keys instead. The SHIFT key 
  45. shows an arrow pointing up; the BACKSPACE key shows an arrow 
  46. pointing to the left; the TAB key shows arrows crashing into 
  47. walls; and the ENTER key shows an arrow that's bent. IBM put 
  48. arrows on those keys instead of words, to help people who don't 
  49. read English.
  50.   In January 1986, IBM began selling a fancier keyboard, which 
  51. contained 101 keys:
  52. ┌───┐     ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ 
  53. ┌───────────┬──────────┬─────┐
  54. │   │     │   │   │   │   │ │   │   │   │   │ │   │   │   │   │ │           
  55. │          │     │
  56. │Esc│     │F1 │F2 │F3 │F4 │ │F5 │F6 │F7 │F8 │ │F9 │F10│F11│F12│ 
  57. │PrintScreen│ScrollLock│Pause│
  58. └───┘     └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ 
  59. └───────────┴──────────┴─────┘
  60.                                                                                        
  61.                                                                                        
  62. ┌─────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ 
  63. ┌────────┬────────┬────────┐ ┌───────┬────┬────┬─────┐
  64. │  ~  │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │       │ │        
  65. │        │        │ │       │    │    │     │
  66. │  `  │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│ │ 
  67. Insert │  Home  │ PageUp │ │NumLock│ /  │ *  │  -  │
  68. ├─────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ 
  69. ├────────┼────────┼────────┤ ├───────┼────┼────┼─────┤
  70. │LeftTab│ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │  |  │ │        
  71. │        │        │ │   7   │ 8  │ 9  │     │
  72. │Tab    │   │   │   │   │   │   │   │   │   │   │ [ │ ] │  \  │ │ 
  73. Delete │  End   │PageDown│ │  Home │   │PgUp│     │
  74. ├───────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ 
  75. └────────┴────────┴────────┘ ├───────┼────┼────┤     │
  76. │        │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │        │                              
  77. │   4   │ 5  │ 6  │     │
  78. │CapsLock│   │   │   │   │   │   │   │   │   │ ; │ ' │   Enter│                              
  79. │      │    │ ■  │  +  │
  80. ├────────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤          
  81. ┌────────┐          ├───────┼────┼────┼─────┤
  82. │          │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │          │          
  83. │        │          │   1   │ 2  │ 3  │     │
  84. │Shift     │   │   │   │   │   │   │   │ , │ . │ / │     Shift│          
  85. │       │          │  End  │   │PgDn│     │
  86. ├──────────┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬─────────┤ 
  87. ┌────────┼────────┼────────┐ ├───────┴────┼────┤     │
  88. │           │     │                           │     │         │ │        
  89. │        │        │ │            │ .  │     │
  90. │Ctrl       │ Alt │           Space           │ Alt │     Ctrl│ │       
  91. │       │   ■    │ │    Ins     │Del │Enter│
  92. └───────────┴─────┴───────────────────────────┴─────┴─────────┘ 
  93. └────────┴────────┴────────┘ └────────────┴────┴─────┘
  94. At first, that fancier keyboard was available just on an IBM 
  95. computer called the IBM RS. Later, IBM made that keyboard 
  96. available for the newest versions of the IBM PC XT and IBM PC AT 
  97. and for the IBM PS/2. Today, IBM sells just that 101-key 
  98. keyboard; it no longer sells the old 83-key keyboard.
  99.   Which keyboard does your computer have? If you have an 83-key 
  100. keyboard, double-check to make sure you found the important keys 
  101. correctly. . . . 
  102. The left SHIFT key is above the ALT key.
  103. The right SHIFT key is above the CAPS LOCK key.
  104. The BACKSPACE key is in the top row and left of the NUM LOCK key.
  105. The TAB key is left of the Q.
  106. The ENTER key is above the PRT SC key.
  107.  
  108.  
  109.   To type a number easily, use the keys in the top row of the 
  110. main part of the keyboard. (For example, to type 4, press the key 
  111. that has a 4 and a dollar sign.) Do not press the number keys on 
  112. the right side of the keyboard: they produce numbers only if the 
  113. NUM LOCK key is pressed beforehand, by you or the computer. If 
  114. the NUM LOCK key was pressed to produce numbers, and you want to 
  115. stop making those keys produce numbers, just tap the NUM LOCK key 
  116. again.
  117.  
  118.        Get started (page 325)
  119.   Start by obeying the instructions on pages 79 and 80. If you 
  120. have a hard disk, those instructions make the computer say 
  121. ``C:\>''. If you don't have a hard disk, those instructions make 
  122. the computer say ``A>'' or ``A:\>''.
  123.   Versions of BASIC Two popular versions of BASIC have been 
  124. invented for the IBM PC.
  125.   The old version is called GWBASIC. (The GW stands for ``gee 
  126. whiz''). The new version is called QBASIC. (The Q stands for 
  127. ``quick'').
  128.   MS-DOS versions 5 & 6 include a pair of files that make the 
  129. computer understand QBASIC. Those files are called ``QBASIC.EXE'' 
  130. and ``QBASIC.HLP''.
  131.   Most older versions of MS-DOS include a file that makes the 
  132. computer understand GWBASIC. That file is usually called 
  133. ``GWBASIC.EXE''; but some versions of MS-DOS call it 
  134. ``BASIC.COM'' or ``BASICA.COM'' instead. Some versions of MS-DOS 
  135. lack the file altogether and can't do BASIC.
  136.   Getting into QBASIC If you're planning to use QBASIC (because 
  137. you bought MS-DOS version 5 or 6), type ``qbasic'' after the C 
  138. prompt, like this:
  139. C:\>qbasic
  140.   The computer will say:
  141. Welcome to MS-DOS QBasic
  142. Press the Esc key, then the F6 key.
  143.   Instead of saying ``OK'', the computer will show a blinking 
  144. line near the screen's bottom left corner.
  145.   Getting into GWBASIC If you're planning to use GWBASIC (because 
  146. you bought an old version of MS-DOS), here's what to do. . . . 
  147.   If you have a hard disk, try typing:
  148. C:\>gwbasic
  149. If the computer gripes (by saying ``Bad command or file name''), 
  150. try typing:
  151. C:\>basica
  152. If the computer still gripes (by saying ``Bad command or file 
  153. name'' again), try typing:
  154. C:\>basic
  155. If the computer still gripes (by saying ``Bad command or file 
  156. name'' again), try saying ``dos\gwbasic'' or ``dos\basica'' or 
  157. ``dos\basic''.
  158.   If you do not have a hard disk, find the floppy that contains 
  159. GWBASIC.EXE or BASICA.COM or BASIC.COM. Insert that floppy into 
  160. drive A and say ``gwbasic'' or ``basica'' or ``basic''.
  161.   When you get into GWBASIC successfully, the computer will say 
  162. the word ``Ok''.
  163.                                          If the computer does not 
  164. say the word ``Ok'', you probably used the wrong version of DOS. 
  165. Make sure your version of DOS came from your computer's 
  166. manufacturer. For example, if IBM built your computer, use IBM's 
  167. PC-DOS, not a clone version of MS-DOS. If a clone company built 
  168. your computer, use your clone's version of MS-DOS, not IBM's 
  169. PC-DOS. Using the wrong version of DOS makes the computer print a 
  170. strange message, the screen go crazy, or the keyboard stop 
  171. working.
  172.                                          If you have an IBM PC 
  173. Junior, buy the BASIC cartridge and put it into the left 
  174. cartridge slot before you turn the computer on. (That cartridge 
  175. makes the Junior understand CIRCLE, PAINT, PLAY, TIMER, and the 
  176. BASIC words for disks.) If your Junior is attached to a monitor 
  177. instead of a TV, type ``width 80'' after the computer says 
  178. ``Ok''.
  179.                                          How to leave QBASIC When 
  180. you finish using QBASIC, say ``File eXit'' (by tapping the Alt 
  181. key, then the F key, then the X key). If the computer asks ``Save 
  182. it now?'', say ``No'' (by pressing N).
  183.                                          How to leave GWBASIC 
  184. When you finish using GWBASIC, type the word ``system'' (and 
  185. press ENTER).
  186.  
  187.                                                   Math (page 326)
  188.                                          In QBASIC, when you give 
  189. a command (such as PRINT 5+2), the answer appears at the bottom 
  190. of the screen; after you examine the answer, press ENTER.
  191.  
  192.                                               Three steps (page 328)
  193.                                          The way to program 
  194. depends on whether you're using GWBASIC or QBASIC.
  195.                                          GWBASIC In GWBASIC, if 
  196. you're too lazy to type the word RUN, just press the F2 key, 
  197. which makes the computer automatically type the word RUN for you 
  198. and automatically press the ENTER key for you. On an PC Junior, 
  199. press the Junior's Fn key before F2.
  200.                                          QBASIC In QBASIC, here's 
  201. how to program your computer.
  202.                                          First, say ``File New'' 
  203. (by pressing the Alt key, then the F key, then the N key). If the 
  204. computer asks ``Save it now?'', say ``No'' (by pressing the N key 
  205. again).
  206.                                          Next, make sure the 
  207. blinking underline is in the top part of the screen. (If the 
  208. blinking underline is in the bottom part, move it to the top part 
  209. by pressing the F6 key).
  210.                                          Then type your program. 
  211. You do not have to type a number in front of each line; those 
  212. numbers are optional. Instead of typing ___ 
  213. 1 print "I love you"
  214. 2 print "you turn me on"
  215. 3 print "let's get married"
  216. you can type:
  217. print "I love you"
  218. print "you turn me on"
  219. print "let's get married"
  220.                                          Finally, say ``Run'' (by 
  221. pressing the F5 key). At the bottom of the screen, the computer 
  222. will print everything you requested; it will print:
  223. I love you
  224. you turn me on
  225. let's get married
  226.                                          When you finish 
  227. examining that printing, press the ENTER key.
  228.      Another example (page 329)
  229.   In QBASIC, do not type the word LIST, since the top part of the 
  230. screen shows the list of your program already.
  231.   In GWBASIC, if you're too lazy to type the word LIST, just 
  232. press the F1 key, which makes the computer automatically type the 
  233. word LIST for you. Then press ENTER. On a PC Junior, press the Fn 
  234. key before F1.
  235.  
  236.     Correcting errors (page 330)
  237.   In QBASIC, if you mess up a line, do not retype it underneath. 
  238. Instead, press the arrow keys to move to the first character you 
  239. want to revise, then repeatedly press the DELETE (or Del) key 
  240. until all the bad characters disappear, then type the characters 
  241. you wish to insert, then press the down-arrow key.
  242.  
  243.  What if computer gripes? (page 330)
  244.   If the computer gripes at you, press the ENTER key immediately.
  245.   After pressing the ENTER key, correct the error by retyping the 
  246. line that the computer griped about.
  247.  
  248.  Rearranging your program (page 331)
  249.   In QBASIC, the computer does not rearrange your program.
  250.   Here's how to make QBASIC erase a line. Move to that line (by 
  251. pressing the arrow keys). Then, while holding down the Ctrl key, 
  252. tap the Y key (which means ``Yank out the line'').
  253.   Here's how to make QBASIC insert a new line. Move to where you 
  254. want the new line to begin. Then, while holding down the Ctrl 
  255. key, tap the N key (which means ``New line'').
  256.  
  257.      Ranges of lines (page 332)
  258.   QBASIC doesn't understand ranges of lines.
  259.  
  260.         Arrow keys (page 332)
  261.   The DELETE key says ``Del'' on it. The INSERT key says ``Ins'' 
  262. on it.
  263.   In QBASIC, do not press the INSERT key, and do not press the 
  264. ENTER key at the end of your correction.
  265.  
  266.      Clear the screen (page 333)
  267.   Your keyboard lacks a CLEAR key. To clear the screen, give the 
  268. CLS command.
  269.   In GWBASIC, here's another way to clear the screen: while 
  270. holding down the Ctrl key, tap the HOME key. (On a PC Junior do 
  271. this instead: While pressing Ctrl, tap Fn then HOME.)
  272.  
  273.       Print on paper (page 333)
  274.   There is no key marked ``PRINT''. To print a screen dump, do 
  275. this instead: if your keyboard is modern (and has 101 keys), 
  276. press the key marked ``PRINT SCREEN''. If your keyboard is 
  277. old-fashioned (and has just 83 keys), press the PrtSc key while 
  278. holding down the SHIFT key. If you have a PC Junior, press the Fn 
  279. key then the PrtSc key.
  280.                                          Most computers lack an 
  281. ECHO key. In QBASIC, you cannot echo. In GWBASIC, here's how to 
  282. echo: press the PrtSc key while holding down the Ctrl key. To 
  283. echo on the PC Junior, press the Fn key then the ECHO key.
  284.                                          In QBASIC, instead of 
  285. saying LLIST do this: say ``File Print'' (by pressing Alt then F 
  286. then P), then press ENTER.
  287.  
  288.                                                  GO TO (page 334)
  289.                                          The BREAK key is the 
  290. last key in the top row. If your keyboard has 83 keys, the BREAK 
  291. key says SCROLL LOCK on it; if your keyboard has 101 keys, the 
  292. BREAK key says PAUSE on it.
  293.                                          The BREAK key works only 
  294. if you simultaneously hold down the Ctrl key. So to abort a 
  295. program, do this: hold down the Ctrl key; and while you keep 
  296. holding down the Ctrl key, tap the BREAK key.
  297.                                          PC Junior Press the Fn 
  298. key before pressing BREAK. You do not have the press the Ctrl 
  299. key.
  300.                                          QBASIC Instead of typing 
  301. this ___ 
  302. 10 print "cat"
  303. 20 print "dog"
  304. 30 go to 10
  305. you can type:
  306. 10 print "cat"
  307. print "dog"
  308. go to 10
  309. Instead of using a number (such as 10), you can use a name (such 
  310. as JOE), but you must put a colon after the name, like this:
  311. joe: print "cat"
  312. print "dog"
  313. go to joe
  314.                                          After you abort a QBASIC 
  315. program, pressing F5 makes the computer continue where it left 
  316. off; pressing SHIFT with F5 makes the computer run the program 
  317. from the beginning.
  318.  
  319.                                                   STOP (page 336)
  320.                                          In QBASIC, when the 
  321. computer encounters the word STOP in a program, the computer 
  322. stops running the program. Then it lists the program and 
  323. highlights the line of your program that said STOP.
  324.  
  325.                                               Save on disk (page 336)
  326.                                          Before using a blank 
  327. disk, make sure the disk has been formatted. To learn how to 
  328. format a disk, read my MS-DOS chapter.
  329.                                          In QBASIC, instead of 
  330. typing SAVE ``JOE'', do this: say ``File Save'' (by pressing Alt 
  331. then F then S), then type JOE (and press ENTER). QBASIC doesn't 
  332. understand the word ``FILES''.
  333.                                          How to use other drives 
  334. When you tell the computer to save JOE, the computer normally 
  335. puts JOE into drive C's root directory (if you have a hard disk) 
  336. or drive A's directory (if you have no hard disk). If you want 
  337. the computer to put JOE into drive B instead, say ``b:joe'' 
  338. instead of ``joe''.
  339.                                          To make GWBASIC print 
  340. the names of all the programs in drive B, type this:
  341. files "b:"
  342. Exception: if you're using an obsolete version of DOS (version 1 
  343. or version 1.05 or version 1.1), you must type this instead:
  344. files "b:*.*"
  345.  
  346.    How to choose a name (page 337)
  347.   Your program's name can be short (such as JOE) or long: up to 8 
  348. characters. The name's first character must be a letter; the 
  349. remaining characters should be letters or digits.
  350.  
  351.       Load from disk (page 337)
  352.   In QBASIC, instead of typing LOAD ``JOE'', do this: say File 
  353. Open (by pressing Alt then F then O), then type JOE (and press 
  354. ENTER); if the computer asks ``Save it now?'', say ``No'' (by 
  355. pressing N).
  356.  
  357.       Edit the disk (page 337)
  358.   QBASIC doesn't understand RENAME at all. In GWBASIC, instead of 
  359. saying RENAME ``JOE'' TO ``FRED'', say NAME ``JOE.BAS'' AS 
  360. ``FRED.BAS'', to emphasize that JOE was written in BASIC.
  361.  
  362.     Space on the disk (page 337)
  363.   QBASIC doesn't understand KILL at all. In GWBASIC, instead of 
  364. saying KILL ``JOE'', say KILL ``JOE.BAS''.
  365.  
  366.           Tapes (page 337)
  367.   Since practically everybody who buys an IBM PC uses disks 
  368. instead of tapes, I won't bother explaining IBM's tape system.
  369.  
  370.       FOR . . . NEXT (page 355)
  371.   To indent, you can hit the SPACE bar repeatedly. But to indent 
  372. more easily, hit the TAB key (which is left of the Q key and has 
  373. arrows on it).
  374.   In QBASIC, if you indent a line (by hitting the SPACE bar 
  375. repeatedly, or by hitting the TAB key), the computer will assume 
  376. you want to indent the line underneath also, and so the computer 
  377. will automatically indent that line for you. If the computer 
  378. indents a line that you don't want indented, erase the 
  379. indentation by hitting the BACKSPACE key.
  380.  
  381.        Renumbering (page 367)
  382.   QBASIC doesn't understand RENUM.
  383.  
  384.       The PAUSE key (page 367)
  385.   If your keyboard has just 83 keys, it lacks a PAUSE key, so to 
  386. pause do this instead: while holding down the Ctrl key, tap the 
  387. NUM LOCK key. To make the PC Junior pause, press the Fn key then 
  388. the PAUSE key.
  389.   To stop pausing, press the ENTER key.
  390.  
  391.           Zones (page 368)
  392.   Your screen has five zones. Zones 1-4 are each 14 characters 
  393. wide. Zone 5 is 24 characters wide.
  394.                                             How many pixels? (page 372)
  395.                                          IBM-compatible computers 
  396. can handle several different screen modes:
  397. Mode                                         Video card      
  398. Pixels                                                             
  399. Colors
  400.  1                                           CGA (or EGA, MCGA, 
  401. VGA)                                                         320 
  402. by 200                                                             
  403. 4
  404.  2                                           CGA (or EGA, MCGA, 
  405. VGA)                                                         640 
  406. by 200                                                             
  407. 2
  408.  
  409.  3                                           Hercules 
  410. monochrome720 by 348                                               
  411. 2
  412.  4                                           Olivetticolor   640 
  413. by 400                                                             
  414. 2
  415.  
  416.  7                                           EGA (or VGA)    320 
  417. by 200                                                             
  418. 16
  419.  8                                           EGA (or VGA)    640 
  420. by 200                                                             
  421. 16
  422.  9                                           EGA (or VGA)    640 
  423. by 350                                                             
  424. 4 or 16
  425.  
  426. 10                                           EGA mono (or VGA 
  427. mono)                                                        640 
  428. by 350                                                             
  429. 4
  430.  
  431. 11                                           MCGA (or VGA)   640 
  432. by 480                                                             
  433. 2
  434. 12                                           VGA             640 
  435. by 480                                                             
  436. 16
  437. 13                                           MCGA (or VGA)   320 
  438. by 200                                                             
  439. 256
  440.                                          For example, here's what 
  441. row 1 of that chart means:
  442. To use mode 1, your video card must be CGA (or EGA or MCGA or 
  443. VGA).
  444. That mode lets you use 320 values of X (numbered from 0 to 319).
  445. That mode lets you use 200 values of Y (numbered from 0 to 199).
  446. That mode lets the screen display 4 colors simultaneously.
  447.                                          Special mono modes Modes 
  448. 3 and 10 require monochrome monitors; they do not work with color 
  449. monitors. In mode 3, you have just 2 ``colors'': black and white.
  450.                                          Special color modes In 
  451. mode 9, you usually get 16 colors, but you get just 4 colors if 
  452. the video card is EGA having just 64K of video RAM.
  453.                                          Mode 4 requires a color 
  454. video card made by Olivetti. That card is included in the AT&T 
  455. 6300 computer.
  456.                                          Text mode There's also a 
  457. ``mode 0'', which works on all computers and produces just text 
  458. (no graphics).
  459.                                          Versions of BASIC QBASIC 
  460. (which comes with DOS 5) understands all modes. GWBASIC 
  461. understands less:
  462. GWBASIC using DOS 1, 1.1, 2, 2.1, or 3 understands just modes 0, 
  463. 1, and 2.
  464. GWBASIC using DOS 3.1 or 3.2 understands modes 0, 1, 2, and 3.
  465. GWBASIC using DOS 3.3 or 4 understands modes 0 through 10.
  466.                                          Which mode to choose If 
  467. you're using QBASIC (which understands all modes), here's which 
  468. mode to choose:
  469. Video card                                           Which mode 
  470. to choose
  471. Hercules monochrome                                   3
  472. Olivetti color                                        4
  473. CGA color                                             1 (for many 
  474. colors) or 2 (for many pixels)
  475. EGA mono or VGA mono                                 10
  476. EGA color                                             9
  477. MCGA color                                           11 (for many 
  478. pixels) or 13 (for many colors)
  479. VGA color                                            12 (for many 
  480. pixels) or 13 (for many colors)
  481.                                          For GWBASIC using DOS 
  482. 3.3 or 4, use that same chart, but choose mode 9 instead of modes 
  483. 11, 12, and 13.
  484.                                          For GWBASIC using DOS 
  485. 3.1 or 3.2, use this chart instead:
  486. Video card                                           Which mode 
  487. to choose
  488. Hercules monochrome                                   3
  489. any other video card                                  1 (for many 
  490. colors) or 2 (for many pixels)
  491.                                          How to change mode 
  492. Before giving any commands about pixels, tell the computer which 
  493. mode you want. For example, if you want mode 1, say:
  494. screen 1
  495.  
  496.   Whenever you finish using pixels, return to text mode by 
  497. saying:
  498. screen 0
  499. width 80
  500. The ``width 80'', which makes sure the screen will display 80 
  501. characters per line, is necessary only if you'd been using mode 
  502. 1, 7, or 13.
  503.   PC Junior The PC Junior handles modes 0, 1, and 2. It also 
  504. handles special versions of modes 3, 4, 5, and 6:
  505. PC Junior modePixelsColors
  506. 3           160 by 20016
  507. 4           320 by 200 4
  508. 5           320 by 20016
  509. 6           640 by 200 4
  510. Modes 5 and 6 require at least 128K of RAM and require that you 
  511. give this command beforehand:
  512. clear,,,32768
  513.  
  514.     Fundamental shapes (page 372)
  515.   Say PSET instead of PLOT.
  516.  
  517.           Colors (page 372)
  518.   In modes 4, 7, 8, and 12, you can choose from the 16 colors 
  519. listed on page 372.
  520.   In mode 1, you must choose from these 4 colors instead:
  521. 0. black
  522. 1. cyan (greenish blue)
  523. 2. magenta (purplish red)
  524. 3. cream (yellowish white)
  525. For example, if you type ___ 
  526. line (0,0)-(100,0),2
  527. the computer will draw a line using color 2, which is magenta.
  528.   In modes 2, 3, and 11, you must choose from these 2 colors 
  529. instead:
  530. 0. black
  531. 1. white
  532.   In mode 10, you have these 4 choices:
  533. 0. black
  534. 1. cream
  535. 2. blink
  536. 3. white
  537.   In mode 9, you can usually choose from the 16 colors mentioned 
  538. on page 372; but if you're using mode 9 with an EGA card having 
  539. just 64K of RAM, you're restricted to the 4 colors used in mode 
  540. 1.
  541.   In mode 13, you can choose from the 16 colors listed on page 
  542. 372 ___ and many more colors, too! Here's the spectrum:
  543.   0 through   7: black, blue, green, cyan, red, magenta, brown, 
  544. cream
  545.   8 through  15: same colors as above, but lighter
  546.  16 through  31: shades of gray (from dark to light)
  547.  32 through  55: color blends (from blue to red to green to blue 
  548. again)
  549.  56 through  79: same color blends, but lighter
  550.  80 through 103: same color blends, but even lighter
  551. 104 through 175: same as 32 through 103, but darker
  552. 176 through 247: same as 104 through 175, but even darker
  553. 248 through 255: black
  554.   
  555.    Advanced commands (and page #)
  556.   PLAY (page 374). In the PLAY command, you can use the symbol 
  557. ``>'' to mean ``go up an octave'', and you can use the symbol 
  558. ``<'' to mean ``go down an octave''. For example, if you say ___ 
  559. play "g>cd<g"
  560. the computer will play the note G, then go up an octave to play C 
  561. and D in
  562. that higher octave, then go down to the original octave to play G 
  563. again. Exception: if you're using an obsolete version of DOS 
  564. (version 1 or 1.05 or 1.1), the symbols ``>'' and ``<'' don't 
  565. work.
  566.                                          The lowest note the 
  567. computer can play (which is the C in octave 0) is called ``note 
  568. 1''. The highest note the computer can play (which is the B in 
  569. octave 6) is called ``note 84''. To make the computer play note 
  570. 84, type this:
  571. play "n84"
  572. To make the computer play its lowest note (1), then its middle 
  573. note (42), then its highest note (84), type this:
  574. play "n1n42n84"
  575.                                          PC Junior. If you turn 
  576. up the volume on your TV or monitor, and then say SOUND ON, you 
  577. can make the Junior's three voices sing simultaneously, like 
  578. this:
  579. play "gab","efg","ccd"
  580. While the first voice is singing ``gab'', the second voice sings 
  581. ``efg'', and the third voice sings ``ccd''.
  582.                                          Random integers (388). 
  583. Instead of saying just RANDOMIZE, say RANDOMIZE TIMER. Exception: 
  584. if you're using GWBASIC with an obsolete version of DOS (version 
  585. 1 or 1.05 or 1.1), you must say RANDOMIZE VAL(RIGHT$(TIME$,2)).
  586.                                          To get a random integer 
  587. between 1 and 5, instead of saying RND(5), say 1+INT(RND*5).
  588.                                          Types of numbers (397). 
  589. In GWBASIC, if your program involves trigonometry (SIN, COS, TAN, 
  590. ATN) or exponents (^, SQR, EXP, LOG), and you want those 
  591. computations done with double-precision accuracy, you must say 
  592. ``gwbasic/d'' (instead of just ``gwbasic''), or say ``basica/d'' 
  593. (instead of just ``basica'').
  594.                                          In QBASIC, 
  595. double-precision numbers can go higher than real numbers: the 
  596. highest permissible double-precision number is about 1D308.
  597.                                          Accuracy (397). In 
  598. QBASIC, if you type a double-precision number, the computer 
  599. handles just the first 15 digits accurately.
  600.                                          Joystick (408). The 
  601. coordinates of joystick A are STICK(0) and STICK(1). The 
  602. coordinates of joystick B are STICK(2) and STICK(3).
  603.                                          When the computer comes 
  604. to a line that mentions STICK(0), the computer looks at both 
  605. joysticks and computes STICK(0), STICK(1), STICK(2), and 
  606. STICK(3). If your program mentions STICK(1) or STICK(2) or 
  607. STICK(3), without mentioning STICK(0), the computer won't look at 
  608. the joysticks.
  609.                                          Mouse (408). Neither 
  610. GWBASIC nor QBASIC is designed to control a mouse.
  611.                                          Peek (414). Your 
  612. computer's memory is divided into segments. Each segment contains 
  613. 64K of RAM or ROM.
  614.                                          Before saying PEEK or 
  615. POKE, tell the computer which segment to use. For example, if you 
  616. want the computer to use segment 3, begin your program by saying:
  617. 10 def seg=3
  618.                                          If you then say PRINT 
  619. PEEK(50000), the computer will peek at the 50000th cell of 
  620. segment 3. If you forget to say DEF SEG, or say just ___ 
  621. 10 def seg
  622. without putting a number afterwards, the computer will use its 
  623. ``favorite'' segment.
  624.                                          Although you can play 
  625. cute tricks by using the words PEEK and POKE, most IBM 
  626. programmers avoid those words, for three reasons:
  627.                                          1. PEEK and POKE are 
  628. awkward to use, because you must remember to say DEF SEG 
  629. beforehand.
  630.                                          2. The PEEKs and POKEs 
  631. that work on your computer system might not work on your friend's 
  632. computer system, because different clones and DOS versions use 
  633. different memory cells.
  634.                                          3. DOS and BASIC include 
  635. many commands that are easier than PEEK and POKE and accomplish 
  636. similar goals. To learn about them, browse through the DOS and 
  637. BASIC manuals that came with your computer.
  638.                                          If you insist on 
  639. fiddling with PEEKs and POKEs, read David Schneider's magazine 
  640. article, which reveals the secrets of dozens of memory cells. 
  641. Part 1 of his article is on pages 201-218 of the 11/12/85 issue 
  642. of PC Magazine; part 2 is on pages 187-208 of the 11/26/85 issue. 
  643. The articles are excerpted from the end of his book, called the 
  644. Handbook of BASIC for the IBM PC Revised and Expanded, published 
  645. by the Brady Book division of Simon & Schuster.
  646.                                          PUT (417). In GWBASIC, 
  647. if you want the record length to be more than 128, you must warn 
  648. the computer. For example, to warn the computer that you'll want 
  649. a record length of 400, say ``gwbasic/s:400'' (instead of just 
  650. ``gwbasic''), or say ``basica/s:400'' (instead of just 
  651. ``basica'').
  652.  
  653.  
  654.                     APPLE MAC
  655.   Here's how to use BASIC on Apple's Mac Plus computer. (Other 
  656. Macs are similar.)
  657.  
  658.            Microsoft BASIC (page 322)
  659.   When you buy the computer, make sure you also buy Microsoft 
  660. Quick BASIC. It costs $65 and comes on two disks. It works an all 
  661. Macs except the most
  662.   It works only on modern Macs (such as the Mac Plus, Mac SE, Mac 
  663. SE/30, Mac Classic, Mac LC, Mac 2, Mac 2cx, Mac 2ci, Mac 2si, and 
  664. Mac 2fx.) It does not work on older Macs (the 128K Mac, 512K Mac, 
  665. and 512KE Mac), since they contain obsolete ROM chips.
  666.   Make sure you buy ``Microsoft Quick BASIC'', not just 
  667. ``Microsoft BASIC'', which is obsolete.
  668.   Here's how to use Microsoft Quick BASIC. (I'll also explain how 
  669. old ``Microsoft BASIC'' differs.)
  670.  
  671.              The keyboard (page 324)
  672.   The keys are placed like this:
  673. ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬──────┐ 
  674. ┌───┬───┬───┬─────┐
  675. │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │      │ │   
  676. │   │   │     │
  677. │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │Backsp│ 
  678. │Clr│ = │ / │   * │
  679. ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬────┤ 
  680. ├───┼───┼───┼─────┤
  681. │     │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │    │ │   
  682. │   │   │     │
  683. │Tab  │   │   │   │   │   │   │   │   │   │   │ [ │ ] │    │ │ 7 
  684. │ 8 │ 9 │   - │
  685. ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┘    │ 
  686. ├───┼───┼───┼─────┤
  687. │      │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │       │ │   
  688. │   │   │     │
  689. │Caps  │   │   │   │   │   │   │   │   │   │ ; │ ' │ Return│ │ 4 
  690. │ 5 │ 6 │   + │
  691. ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┬───┤ 
  692. ├───┼───┼───┼─────┤
  693. │        │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │     │   │ │   
  694. │   │   │     │
  695. │Shift   │   │   │   │   │   │   │   │ , │ . │ / │Shift│  │ │ 1 
  696. │ 2 │ 3 │     │
  697. ├──────┬─┴───┴─┬─┴───┴───┴───┴───┴───┴───┴─┬─┴─┬─┴─┬───┼───┤ 
  698. ├───┴───┼───┤     │
  699. │      │       │                           │ │ │   │   │   │ │       
  700. │   │     │
  701. │Option│Command│          Space            │ \ │  │ ■ │  │ │  0    
  702. │ . │Enter│
  703. └──────┴───────┴───────────────────────────┴───┴───┴───┴───┘ 
  704. └───────┴───┴─────┘
  705.   To the left of the SPACE bar, you'll see the COMMAND key. In 
  706. the diagram, I wrote the word ``Command'' on that key; but if you 
  707. look at your actual Mac keyboard, you'll see a picture of a 
  708. highway's cloverleaf on that key instead.
  709.   The keyboard contains a RETURN key and also an ENTER key. When 
  710. you're using BASIC, those keys do the same thing as each other. 
  711. You'll probably prefer the RETURN key, since your pinky can reach 
  712. it more easily.
  713.  
  714.              Get started (page 325)
  715.   To start using the Mac, read the chapter that explains the Mac 
  716. Finder. Practice what's in that chapter, before you start playing 
  717. with BASIC.
  718.   When you've practiced what's in that chapter, here's how to 
  719. start using BASIC.
  720.   If you own an external hard drive, turn it on, and wait for the 
  721. clicking to stop. Then turn on the Mac. Adjust the Mac's 
  722. brightness knob, until you can read the screen. If the screen 
  723. doesn't show a trash can, insert System Tools Disk #1, then eject 
  724. it (by choosing Eject from the File menu).
  725.   Now your Mac screen shows the trash can, and your floppy-disk 
  726. drive is empty.
  727.   Insert the Microsoft Quick BASIC disk whose label says 
  728. ``Program''. Then double-click the Program icon. (If you're using 
  729. old Microsoft BASIC instead, insert the disk whose label says 
  730. ``Interpreter'', then double-click the Microsoft BASIC icon.)
  731.   The disk contains two versions of BASIC. The binary version 
  732. computes quickly: it's used by scientists who want blazing speed. 
  733. The decimal version computes slowly but handles decimals with 
  734. extra accuracy: it's used by accountants who are in no rush, but 
  735. insist on never being off by a penny.
  736.   To choose the binary version, double-click the ``Microsoft 
  737. Quick BASIC (b)'' icon. To choose the decimal version instead, 
  738. double-click the ``Microsoft Quick BASIC (d)'' icon instead.
  739.                                                      The icon 
  740. will explode.
  741.                                                      If you're 
  742. using Microsoft Quick BASIC (instead of old Microsoft BASIC), and 
  743. you don't have a hard disk or second floppy drive, the computer 
  744. will tell you to swap disks 16 times. Obey the computer, and be 
  745. patient!
  746.                                                      Make the 
  747. command window appear on the screen and be active. To do that, 
  748. choose Command from the Windows menu, or use this short cut: 
  749. while holding down the COMMAND key, type a period. (Old Microsoft 
  750. BASIC permits an even shorter cut: just click the word 
  751. ``Command'' at the bottom of the screen.)
  752.                                                      Instead of 
  753. saying OK, the computer shows a blinking vertical line.
  754.                                                      How to quit 
  755. Whenever you're done using BASIC, choose Quit from the File menu 
  756. (or tap the Q key while holding down the COMMAND key).
  757.                                                      Then the 
  758. computer might say:
  759. Current program is not saved. Do you
  760. want to save it before proceeding?
  761. Cancel    No    Yes
  762. If the computer says that, click the word ``No''.
  763.                                                      Then choose 
  764. Shut Down from the Special menu. When the computer says ``You may 
  765. now switch off your Macintosh safely'', turn off the Mac and then 
  766. any external hard drive.
  767.  
  768.                                                         Math (page 326)
  769.                                                      When you 
  770. type a command (such as PRINT 5+2), the command appears at the 
  771. bottom of the screen, in the command window. The computer prints 
  772. the answer (7) at the top of the screen, in the output window.
  773.    Long commands on small screens
  774.              (page 328)
  775.   Keep your commands short. If you type a command that's too long 
  776. to fit on a line, the computer has difficulty handling it.
  777.  
  778.        Three steps (page 328)
  779.   Programming your computer consists of three steps. . . . 
  780.   Step 1: say NEW But instead of typing the word NEW, choose New 
  781. from the File menu. If you're lucky, you'll see horizontal 
  782. stripes next to the word ``List''.
  783.   If you're unlucky, the computer will say:
  784. Current program is not saved. Do you
  785. want to save it before proceeding?
  786. Cancel    No    Yes
  787. Click the word ``No''. You'll see horizontal stripes next to the 
  788. word ``List''.
  789.   Step 2: type your program Whatever you type will appear 
  790. underneath the word ``Listing'', in the list window. (Old 
  791. Microsoft BASIC says ``List'' instead of ``Listing''.)
  792.   You do not have to type a number in front of each line; those 
  793. numbers are optional. Instead of typing ___ 
  794. 1 print "I love you"
  795. 2 print "you turn me on"
  796. 3 print "let's get married"
  797. you can type:
  798. print "I love you"
  799. print "you turn me on"
  800. print "let's get married"
  801.   Step 3: run the program Instead of typing the word RUN and 
  802. pressing ENTER, choose Run Program from the Run menu (or tap the 
  803. R key while holding down the COMMAND key).
  804.   (Old Microsoft BASIC's Run menu says ``Start'' instead of ``Run 
  805. Program''.)
  806.   The list window will disappear. The computer will print 
  807. everything you requested; it will print:
  808. I love you
  809. you turn me on
  810. let's get married
  811. Then the list window will reappear, and you'll see your program 
  812. in the window again.
  813.   Summary of those steps Here's the rule: if you type a list of 
  814. instructions in the list window, the computer won't obey those 
  815. instructions until you choose Run Program (from the Run menu or 
  816. by pressing COMMAND R).
  817.   Changing the list window If your program's too long to fit in 
  818. the list window, the window will show just part of your program. 
  819. To see the rest of your program, use the window's scroll bars.
  820.   Clicking the window's zoom box makes the window expand, so that 
  821. it consumes the entire screen. Clicking the zoom box again makes 
  822. the window shrink back to its original size. (If your old 
  823. Microsoft BASIC lacks a zoom box, double-click the word ``List'' 
  824. instead.)
  825.   Clicking the close box makes the window disappear. To make the 
  826. window reappear, choose List from the Windows menu (or tap the L 
  827. key while holding down the COMMAND key).
  828.                                             Another example (page 329)
  829.                                          Do not type the word 
  830. LIST. It's usually unnecessary, since the computer tries to 
  831. always show the list of your program on the screen. If the 
  832. computer ever fails to show the list on the screen, do not type 
  833. the word LIST: instead, choose List from the Windows menu (or 
  834. press COMMAND L).
  835.  
  836.                                            Correcting errors (page 330)
  837.                                          If you mess up a line, 
  838. do not retype it underneath. Instead, do the following. . . . 
  839.                                          Point at the right edge 
  840. of the rightmost character that you want to revise. Click once. 
  841. Repeatedly press the key marked BACKSPACE or DELETE, until all 
  842. the bad characters disappear. Then type the characters you wish 
  843. to insert. When you've finished typing them, click underneath the 
  844. entire program.
  845.  
  846.                                         What if computer gripes? (page 330)
  847.                                          If you accidentally type 
  848. PRIMT instead of PRINT, when you run the program the computer 
  849. will gripe by saying:
  850. Undefined subprogram
  851. It will also put your program on the screen, and will draw a box 
  852. around the line it griped about.
  853.                                          Click the word ``OK'', 
  854. then revise the bad line.
  855.  
  856.                                         Rearranging your program (page 331)
  857.                                          The computer does not 
  858. rearrange your program! The computer does not put the lines in 
  859. numerical order! If you type 80, the computer will not erase line 
  860. 80!
  861.                                          How to erase a line 
  862. Point slightly left of the leftmost character in the line ___ so 
  863. that you're pointing at the gap between the leftmost character 
  864. and the window's left wall. Press the mouse's button; while you 
  865. keep pressing the button, drag down one line, but without 
  866. touching any characters. The line you want to erase will become 
  867. black. Lift your finger off the button. Press the BACKSPACE key. 
  868. The line will disappear. Click underneath the entire program.
  869.                                          How to insert a new line 
  870. Click at the right edge of the rightmost character of the line 
  871. above. Press the RETURN key. You'll see a gap to put the new line 
  872. in. Type the new line; do not press the RETURN key at the end of 
  873. it. Click underneath the entire program.
  874.  
  875.                                             Ranges of lines (page 332)
  876.                                          To list from line 30 to 
  877. the end of your program, make the command window active (by 
  878. clicking it or choosing Command from the Windows menu or pressing 
  879. the COMMAND and period keys simultaneously). Then type:
  880. list 30
  881.                                          The computer does not 
  882. understand ``LIST 30-80'' or ``LIST -80''.
  883.                                          To delete lines 30 
  884. through 80, make the command window active and type:
  885. delete 30-80
  886. After you type that command (and press the RETURN key), make the 
  887. list window active (by clicking it or choosing List from the 
  888. Windows menu).
  889.         Arrow keys (page 332)
  890.   To insert some text between two characters, click at the gap 
  891. between the two characters, then type the text.
  892.   To delete a group of characters, point at the left edge of the 
  893. first character in the group, then drag to the right edge of the 
  894. last character in the group. The characters you want to delete 
  895. will turn black. Lift your finger off the mouse's button. Press 
  896. the BACKSPACE key. The characters will disappear.
  897.  
  898.      Clear the screen (page 333)
  899.   The CLEAR key doesn't work.
  900.  
  901.       Print on paper (page 333)
  902.   Your keyboard lacks a PRINT key. Instead of pressing a PRINT 
  903. key, press the CAPS LOCK key, so that it stays down; then hold 
  904. down the SHIFT and COMMAND keys; while you keep holding down the 
  905. SHIFT and COMMAND keys, tap the 4 key. The printer will print 
  906. onto paper a copy of the entire screen. When the printer has 
  907. finished, tap the CAPS LOCK key, so that it pops back up. That 
  908. method works if your printer's an Imagewriter but not if it's a 
  909. Laserwriter.
  910.   Your keyboard lacks an ECHO key.
  911.   Your computer understands LPRINT.
  912.   Although your computer understands LLIST (if typed in the 
  913. command window), an easier way to list your program on paper is 
  914. to make the list window active, then choose Print from the File 
  915. menu, then click OK.
  916.  
  917.           GO TO (page 334)
  918.   Instead of typing this ___ 
  919. 10 print "cat"
  920. 20 print "dog"
  921. 30 go to 10
  922. you can type:
  923. 10 print "cat"
  924. print "dog"
  925. go to 10
  926. If you delete the 10 from the top line, the computer will gripe 
  927. when it sees ``go to 10''.
  928.   Instead of using a number (such as 10), you can use a name 
  929. (such as JOE), but you must put a colon after the name, like 
  930. this:
  931. joe: print "cat"
  932. print "dog"
  933. go to joe
  934.   To abort a program, choose Stop from the File menu, or tap the 
  935. period key while holding down the COMMAND key. (Old Microsoft 
  936. BASIC puts ``Stop'' in the Run menu instead of the File menu.)
  937.   After you've aborted a program, if you wish to see a LIST, make 
  938. the list window active (by choosing List from the Windows menu, 
  939. or pressing COMMAND with L).
  940.   How to single-step trace your program If a program runs faster 
  941. than your eye can see or your mind can think, slow it down. To do 
  942. that, instead of choosing Run Program from the Run menu, choose 
  943. Step from the Run menu (or press COMMAND with T).
  944.                                          That makes the computer 
  945. do just one line or subline of your program; then it will pause. 
  946. When you choose Step again, the computer will do the next line or 
  947. subline. Each time you choose Step, the computer will do one more 
  948. line or subline. Each time the computer does a line, it also 
  949. shows the program in the list window, and puts a box around the 
  950. line it just did.
  951.  
  952.                                                   Love (page 334)
  953.                                          If a program involves a 
  954. semicolon with a GO TO, begin the program by saying WIDTH 61, 
  955. like this:
  956. width 61
  957. 10 print "love";
  958. go to 10
  959. If you forget to say WIDTH 61, the computer will print just one 
  960. line of love and then do nothing until you abort.
  961.  
  962.                                                   STOP (page 336)
  963.                                          When the computer 
  964. encounters the word STOP in a program, the computer stops running 
  965. the program. Then it lists the program and puts a box around the 
  966. line of your program that said STOP.
  967.  
  968.                                               Save on disk (page 336)
  969.                                          If you buy a blank disk 
  970. and want to use it, you must initialize the disk. To learn how to 
  971. do that, read the chapter that explains the Mac Finder.
  972.                                          After you initialize 
  973. that disk, you should copy ``Microsoft Quick BASIC (b)'' and 
  974. ``System Folder'' onto that disk, by dragging those icons to that 
  975. disk. To learn how to do that, read the chapter that explains the 
  976. Mac Finder.
  977.                                          You should not save 
  978. programs on the original ``Microsoft BASIC'' disk. Instead, save 
  979. your programs on a new disk that you turned into an easy-to-use 
  980. BASIC disk.
  981.                                          So before you write 
  982. programs to save, turn off the computer, insert a new easy-to-use 
  983. BASIC disk, and then turn the computer back on.
  984.                                          Before typing SAVE 
  985. ``JOE'' or FILES, make the command window active (by clicking it 
  986. or choosing Command from the Windows menu or pressing the COMMAND 
  987. and period keys simultaneously).
  988.                                          Here's a short cut: 
  989. instead of activating the command window and then saying SAVE 
  990. ``JOE'', just choose Save from the File menu and then type JOE 
  991. (followed by RETURN).
  992.  
  993.                                           How to choose a name (page 337)
  994.                                          Your program's name can 
  995. be short (such as JOE) or long: up to 31 characters. Short names 
  996. are better, because they can fit in small windows.
  997.  
  998.                                              Load from disk (page 337)
  999.                                          Before saying LOAD "JOE" 
  1000. or RUN "JOE", activate the command window. Here's a short cut: 
  1001. instead of activating the command window and saying LOAD "JOE", 
  1002. just choose Open from the File menu and double-click JOE.
  1003.  
  1004.                                              Edit the disk (page 337)
  1005.                                          Instead of saying RENAME 
  1006. ``JOE'' TO ``FRED'', say NAME ``JOE'' AS ``FRED''.
  1007.           Tapes (page 337)
  1008.   Your computer can't handle tapes.
  1009.  
  1010.       FOR . . . NEXT (page 355)
  1011.   To indent, you can hit the SPACE bar repeatedly. But to indent 
  1012. more easily, hit the TAB key. Hitting the TAB key has the same 
  1013. effect as hitting the SPACE bar four times.
  1014.   If you indent a line (by hitting the SPACE bar repeatedly, or 
  1015. by hitting the TAB key), the computer will assume you want to 
  1016. indent the line underneath also, and so the computer will 
  1017. automatically indent that line for you.
  1018.   If the computer indents a line that you don't want indented, 
  1019. erase the indentation, by hitting the BACKSPACE key four times.
  1020.  
  1021.        Renumbering (page 367)
  1022.   Your computer doesn't understand RENUM.
  1023.  
  1024.       The PAUSE key (page 367)
  1025.   Your keyboard lacks a PAUSE key ___ but you don't need one. 
  1026. When you list a program, the listing automatically pauses when 
  1027. the list window is filled. While running a program, you can stop 
  1028. temporarily (by choosing Stop from the File menu or pressing 
  1029. CONTROL with a period), then continue where you left off by 
  1030. choosing Continue from the Run menu (or pressing CONTROL with G).
  1031.   Old Microsoft BASIC understands Continue but not CONTROL with 
  1032. G.
  1033.  
  1034.           Zones (page 368)
  1035.   Your screen has 5 zones. Zones 1-4 are each 14 characters wide; 
  1036. zone 5 is 5 characters wide. Altogether, the screen is 61 
  1037. characters wide.
  1038.   Those measurements are for standard-size characters. Your 
  1039. computer can also produce characters that are extra-narrow or 
  1040. extra-wide.
  1041.  
  1042.           Loops (page 369)
  1043.   If a program involves zones with a GO TO, begin the program by 
  1044. saying WIDTH 61, like this:
  1045. width 60
  1046. 10 print "hi",
  1047. go to 10
  1048.  
  1049.      How many pixels? (page 372)
  1050.   The X coordinate goes from 0 to 491. The Y coordinate goes from 
  1051. 0 to 297.
  1052.   The high-numbered pixels hide behind the list and command 
  1053. windows. To see those pixels, put this line at the bottom of your 
  1054. program ___ 
  1055. 9999 go to 9999
  1056. That line creates an infinite loop, which keeps the output window 
  1057. on the screen. When you finish staring at the pixels in the 
  1058. output window, abort the program by choosing Stop from the File 
  1059. menu (or press COMMAND with period).
  1060.  
  1061.     Fundamental shapes (page 372)
  1062.   Say PSET instead of PLOT. The computer draws each shape in 
  1063. black, on a white background.
  1064.                                                  PAINT (page 372)
  1065.                                          Your computer doesn't 
  1066. understand the word PAINT.
  1067.  
  1068.                                                  Colors (page 372)
  1069.                                          The standard Mac 
  1070. displays just black and white: it can't display any other colors. 
  1071. The code number for white is 0; the code number for black is 1. 
  1072. (Any even number produces white; any odd number produces black.)
  1073.  
  1074.                                           Advanced commands (and page #)
  1075.                                          PLAY (page 374). Your 
  1076. computer doesn't understand the word PLAY.
  1077.                                          Random integers (388). 
  1078. Instead of saying just RANDOMIZE, say RANDOMIZE TIMER. To get a 
  1079. random integer from 1 to 5, instead of saying RND(5), say 
  1080. 1+INT(RND*5).
  1081.                                          Types of numbers (397). 
  1082. BASIC comes in two versions ___ binary and decimal ___ which you 
  1083. choose by clicking the appropriate icon.
  1084.                                          Suppose you type a 
  1085. number containing a decimal point. If that number contains fewer 
  1086. than 7 digits, it's a real; if it contains more than 7 digits, 
  1087. it's double-precision; if it contains exactly 7 digits, the 
  1088. binary version treats it as a real, but the decimal version 
  1089. treats it as double-precision instead.
  1090.                                          Accuracy (397). If you 
  1091. type a double-precision number, the binary version handles it to 
  1092. an accuracy of 15 to 16 digits, but the decimal version handles 
  1093. it to an accuracy of just 14 digits.
  1094.                                          Variables (397). If a 
  1095. variable is simple (such as X), the binary version treats it as 
  1096. real, but the decimal version treats it as double-precision.
  1097.                                          Joystick (408). Your 
  1098. computer doesn't use a joystick.
  1099.  
  1100.  
  1101.                  APPLE 2 FAMILY
  1102.   Here's how to use BASIC on the Apple 2c computer. (The Apple 
  1103. 2c+ and 2GS are similar.) I'll explain how the Apple 2, 2+, and 
  1104. 2e differ.
  1105.  
  1106.              The keyboard (page 324)
  1107.   On the Apple 2c, the keys are placed like this:
  1108. ┌─────┬───┬────────┐
  1109. │     │   │        │
  1110. │Reset│40 │Keyboard│
  1111. └─────┴───┴────────┘
  1112. ┌────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬──────┐
  1113. │    │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │      │
  1114. │Esc │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │Delete│
  1115. ├────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬────┤
  1116. │      │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │ │  │
  1117. │Tab   │   │   │   │   │   │   │   │   │   │   │ [ │ ] │ \  │
  1118. ├──────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴────┤
  1119. │       │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │       │
  1120. │Control│   │   │   │   │   │   │   │   │   │ ; │ ' │ Return│
  1121. ├───────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───────┤
  1122. │         │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │         │
  1123. │Shift    │   │   │   │   │   │   │   │ , │ . │ / │    Shift│
  1124. ├────────┬┴──┬┴───┴───┴┬──┴───┴──┬┴───┴───┴─┬─┴─┬─┴─┬───┬───┤
  1125. │        │ ~ │         │         │          │   │   │   │   │
  1126. │CapsLock│ ` │OpenApple│  Space  │SolidApple│  │ ■ │  │  │
  1127. └────────┴───┴─────────┴─────────┴──────────┴───┴───┴───┴───┘
  1128.   The keys next to the SPACE bar are called the Apple keys. In 
  1129. the diagram, I wrote the words ``Open Apple'' and ``Solid Apple'' 
  1130. on those keys; but if you look at your actual Apple 2c keyboard, 
  1131. you'll see pictures of apples on those keys instead.
  1132.   There's no BACKSPACE key.
  1133.   To correct an error, press the left-arrow key, until you get 
  1134. back to where the error was. Then correct the error, by retyping. 
  1135. Then, if you wish, press the right-arrow key to move to the 
  1136. right.
  1137.   Your computer has a key marked DELETE, but it doesn't work when 
  1138. you're using BASIC.
  1139.   The ENTER key says RETURN on it.
  1140.   Apple 2e The Apple 2e keyboard lacks a 40 key and a KEYBOARD 
  1141. key.
  1142.   Apple 2 and 2+ The zero key is Swedish. The CONTROL key says 
  1143. CTRL on it. The letters are automatically capitalized. The keys 
  1144. are rearranged slightly. The following keys are missing: DELETE, 
  1145. TAB, CAPS LOCK, OPEN APPLE, SOLID APPLE, KEYBOARD, 40, 
  1146. down-arrow, up-arrow, left-bracket, right-bracket, backslash, and 
  1147. accent.
  1148.  
  1149.              Get started (page 325)
  1150.   Cut into the right side of your computer, you'll see a 
  1151. horizontal slot about 5 inches long. That slit's the entrance to 
  1152. the built-in drive.
  1153.   At the center of the slit is a door, which is the same color as 
  1154. the keys on the keyboard. To open the door, push it to the left; 
  1155. then it will automatically pop up. To close the door, push it 
  1156. down. Practice opening and closing it.
  1157.   Then open the door. Remove any disk from the built-in drive. 
  1158. Put the ``System Utilities ProDOS disk'' into the built-in drive; 
  1159. when inserting the disk, make sure the disk's label is on top of 
  1160. the disk, and make sure the disk's big oval cutout goes into the 
  1161. drive before the label does. After putting the disk into the 
  1162. drive, close the door.
  1163.   The computer's green power switch is at the computer's rear, 
  1164. and has the numbers 0 and 1 on it. Flip the power switch on, by 
  1165. pressing the 1.
  1166.   Turn on the TV or monitor.
  1167.   If you're using a TV, turn it to channel 3 or 4. To switch the 
  1168. computer from channel 3 to channel 4 or back to channel 3, flip 
  1169. the channel-selection switch, which is on the box attached to the 
  1170. back of the computer. If the writing on the TV looks fuzzy, 
  1171. adjust the TV's fine tuning.
  1172.   Adjust the screen's brightness and contrast.
  1173.                                                      The computer 
  1174. will put several messages onto the screen. Eventually, you'll see 
  1175. the main menu, which looks like this:
  1176. 1.  Copy files
  1177. 2.  Delete files
  1178. 3.  Rename files
  1179. 4.  Lock/unlock files
  1180. 5.  Duplicate a disk
  1181. 6.  Format a disk
  1182. 7.  Identify and catalog a disk
  1183. 8.  Advanced operations
  1184. 9.  Exit system utilities
  1185. Tap the 9 key, then tap the RETURN key twice.
  1186.                                                      You'll see 
  1187. this symbol on the screen, at the upper-left corner:
  1188. ]
  1189. That symbol's called a bracket. It means everything's OK. Your 
  1190. computer prints a bracket instead of the word OK.
  1191.                                                      You can make 
  1192. the characters on your screen be either thin or fat. The screen 
  1193. is wide enough to hold 80 thin characters per line, or 40 fat 
  1194. characters. Fat characters are easier to read, so choose fat 
  1195. characters if your eyesight is poor, or if you're using a cheap 
  1196. TV (which is blurry) instead of a monitor.
  1197.                                                      To choose 
  1198. fat characters (40 per line), tap the ESC key, then the 4 key. To 
  1199. choose thin characters (80 per line), tap the ESC key, then the 8 
  1200. key.
  1201.                                                      Apple 2, 2+, 
  1202. and 2e The disk drive and its slot are in a separate box (instead 
  1203. of being built into the right side of the computer). If you have 
  1204. two disk drives, begin by using disk drive #1, not disk drive #2.
  1205.                                                      Open the 
  1206. disk drive's door, by pulling the door out and up. Remove any 
  1207. disk from the drive. If you have a 2e, insert the ``ProDOS User's 
  1208. Disk''; if you have a 2 or 2+, insert the ``DOS 3.3 System Master 
  1209. Disk'' instead. When inserting the disk, make sure the disk's 
  1210. label is on top of the disk, and make sure the disk's big oval 
  1211. cutout goes into the drive before the label does.
  1212.                                                      Close the 
  1213. door, by pushing it down and in.
  1214.                                                      Turn on the 
  1215. TV or monitor. If you're using a TV, turn it on to channel 33.
  1216.                                                      On the back 
  1217. of the computer, you'll see the computer's power switch, which is 
  1218. black. Flip it to the ON position.
  1219.   Here's what happens next, if you have a 2e:
  1220.   At the top of the screen, a message will appear briefly. If 
  1221. your 2e is old (manufactured before February 1985), the message 
  1222. says ``Apple ][''; if your 2e is new (or you've upgraded your old 
  1223. 2e), the message says ``Apple 2e''. Look at the message, to 
  1224. double-check whether your 2e is old or new.
  1225.   If your 2e is old, it can't handle lower-case letters well, so 
  1226. you must type just capitals. To type capitals easily, press the 
  1227. CAPS LOCK key, and make sure the CAPS LOCK key stays down.
  1228.   Your 2e will also print this menu:
  1229. YOUR OPTIONS ARE:
  1230.      ? - TUTOR: PRODOS EXPLANATION
  1231.      F - PRODOS FILER (UTILITIES)
  1232.      C - DOS <-> PRODOS CONVERSION
  1233.      S - DISPLAY SLOT ASSIGNMENTS
  1234.      T - DISPLAY/SET TIME
  1235.      B - APPLESOFT BASIC
  1236. Tap the B key.
  1237.   Regardless of whether you have a 2, 2+, or 2e, you'll 
  1238. eventually see this symbol near the screen's left edge:
  1239. ]
  1240. That symbol's called a bracket. It means everything's OK. Your 
  1241. computer prints a bracket instead of the word OK.
  1242.   The characters are fat (40 per line). Your Apple might be able 
  1243. to make the characters thin (80 per line), but your Apple handles 
  1244. thin characters reliably only if your Apple is a new 2e that also 
  1245. contains an 80-column card. If you have that kind of Apple and 
  1246. want thin characters, say ___ 
  1247. pr#3
  1248. and press the RETURN key.
  1249.  
  1250.      Ranges of lines (page 332)
  1251.   Instead of saying DELETE, say DEL. To delete lines 30 through 
  1252. 80, type this:
  1253. del 30,80
  1254.  
  1255.         Arrow keys (page 332)
  1256.   To edit line 30, first put line 30 onto the screen, by saying 
  1257. LIST 30. (Say LIST, not EDIT: your computer doesn't understand 
  1258. the word EDIT.)
  1259.   On your computer, the cursor does not blink: it's a solid 
  1260. square that indicates where you'll be typing.
  1261.   Your computer uses the Catholic method of editing, which uses 
  1262. the Catholic cross and its effect on bodies and souls. Here are 
  1263. the details. . . . 
  1264.   Tap the ESC key. A cross will appear in the middle of the 
  1265. cursor.
  1266.   Move the cursor (including its cross) up to the line you want 
  1267. to edit, by pressing the up-arrow key repeatedly. Then tap the 
  1268. ESC key again, to get rid of the cross.
  1269.   (The up-arrow key works only when you see a cross, because, 
  1270. according to Catholics, ``to get to heaven you must follow the 
  1271. Cross''. Most other keys are Temptations: they're effective only 
  1272. when you do not see a cross.)
  1273.   Move the cursor to the part of the line you want to correct, by 
  1274. pressing the right-arrow key repeatedly.
  1275.   Then make your corrections.
  1276.   Replace To replace a character, move the cursor to the 
  1277. character you want to replace, then type the new character you 
  1278. want instead.
  1279.                                          Delete To delete a group 
  1280. of characters, move the cursor to the first character in the 
  1281. group.
  1282.                                          Create a cross (by 
  1283. tapping the ESC key), then move the cross across the group of 
  1284. characters (by pressing the right-arrow key), until you've passed 
  1285. the last character in the group. Then get rid of the cross (by 
  1286. tapping the ESC key again).
  1287.                                          The characters that the 
  1288. cross passed over will go to heaven and disappear from their 
  1289. earthly existence. (Their bodies will remain on the screen, but 
  1290. their souls will departed so the characters won't affect any 
  1291. future LIST.)
  1292.                                          Insert To insert extra 
  1293. characters, move the cursor to the place where you want the extra 
  1294. characters to begin appearing.
  1295.                                          Then move the cursor up 
  1296. (by tapping the ESC key, then the up-arrow key, then the ESC 
  1297. key). Type the characters you want to insert. Then create a cross 
  1298. (by tapping the ESC key), and move the cross to where you want 
  1299. the extra characters to begin appearing (by tapping the 
  1300. down-arrow and left-arrow keys). Finally, get rid of the cross.
  1301.                                          When you finish editing 
  1302. When you've finished correcting the line, press the right-arrow 
  1303. key repeatedly, until you get past the last character in the 
  1304. line. Then press the RETURN key. To see what happened to the 
  1305. line, LIST it.
  1306.                                          Why bother? Because that 
  1307. Catholic method of editing is so long-winded, most programmers 
  1308. don't bother using it: instead, they type the entire line over!
  1309.                                          Apple 2e The editing 
  1310. process is the same as for the 2c, with just two exceptions:
  1311.                                          1. To begin the whole 
  1312. editing process, tap the ESC key, then the left-arrow key, then 
  1313. move the cursor up to the line you want to edit.
  1314.                                          2. You see the cross 
  1315. only if your Apple 2e contains an 80-column card and you 
  1316. previously said PR#3. Otherwise, the cross is invisible: when the 
  1317. cross is at the cursor, the cursor covers up the cross, so that 
  1318. you can't see the cross (even though the cross is there).
  1319.                                          Apple 2 and 2+ The 
  1320. method of editing is even more complicated, so don't bother! Just 
  1321. type the whole line over again.
  1322.  
  1323.                                           Spaces after numbers (page 332)
  1324.                                          Your computer does not 
  1325. automatically put spaces after numbers.
  1326.  
  1327.                                          Spaces before numbers (page 333)
  1328.                                          Your computer does not 
  1329. automatically put spaces before positive numbers.
  1330.                                          For example, if you give 
  1331. this command ___ 
  1332. print "the temperature is";4+25;"degrees"
  1333. the computer prints:
  1334. the temperature is29degrees
  1335. The computer does not automatically put a space before or after 
  1336. the 29.
  1337.                                          To put spaces near the 
  1338. 29, put spaces in the strings nearby, like this:
  1339. print "the temperature is ";4+25;" degrees"
  1340.  
  1341.   Multiple calculations (page 333)
  1342.   If you give this command ___ 
  1343. print 6+2;6-2
  1344. your computer will print the answer to 6+2 (which is 8) and also 
  1345. print the answer to 6-2 (which is 4), but won't put any spaces 
  1346. between the answers. Your computer will print:
  1347. 84
  1348.   To force your computer to put a space between the answers, 
  1349. replace the semicolon by a space in quotation marks, like this:
  1350. print 6+2" "6-2
  1351. That makes your computer print:
  1352. 8 4
  1353.  
  1354.      Clear the screen (page 333)
  1355.   Your keyboard lacks a CLEAR key. Instead of pressing a CLEAR 
  1356. key, press the ESC key, then type an @ symbol. (To type the @ 
  1357. symbol, remember to press the SHIFT key.)
  1358.   Your computer doesn't understand the CLS command. Instead of 
  1359. typing CLS, type the word HOME.
  1360.  
  1361.       Print on paper (page 333)
  1362.   Your keyboard doesn't have a PRINT key or ECHO key, and your 
  1363. computer doesn't understand LPRINT or LLIST. To print on paper, 
  1364. here's what to do instead. . . . 
  1365.    Make sure the printer is plugged in, turned on, and full of 
  1366. paper. Make sure any lights indicating POWER, READY, SELECT, and 
  1367. ON LINE are glowing.
  1368.   To activate the printer, type this:
  1369. pr#1
  1370. That makes the computer use paper instead of your screen. After 
  1371. you type PR#1, everything you and the computer type will appear 
  1372. on paper instead of on the screen.
  1373.   If you ever want to use your screen again, you must deactivate 
  1374. the printer, by typing:
  1375. pr#0
  1376.   For example, to make the computer print just ``I love you'' on 
  1377. paper, you must activate the printer, then tell the computer to 
  1378. print ``I love you'', then deactivate the printer, like this:
  1379. pr#1
  1380. print "I love you"
  1381. pr#0
  1382.   If a program prints on the screen but you want it to print on 
  1383. paper instead, activate the printer before you type RUN. Here's 
  1384. how:
  1385. pr#1
  1386. list
  1387. pr#0
  1388.   In the middle of your program, one of the lines can say 
  1389. ``pr#1''. But if a line of your program simply says ___ 
  1390. 30 pr#1
  1391. the computer will get confused. Instead, say:
  1392. 30 d$=chr$(4)
  1393. 31 ?d$"pr#1"
  1394. To make line 60 deactivate the printer, say:
  1395. 60 ?d$"pr#0"
  1396.  
  1397.                                          For example, this 
  1398. program prints two poems. It prints ``love is like a dove'' on 
  1399. your screen, and prints ``life is full of strife'' on paper:
  1400. new
  1401. 10 print "love"
  1402. 20 print "is like a dove"
  1403. 30 d$=chr$(4)
  1404. 31 ?d$"pr#1"
  1405. 40 print "life"
  1406. 50 print "is full of strife"
  1407. 60 ?d$"pr#0"
  1408. run
  1409.  
  1410.                                                  GO TO (page 334)
  1411.                                          To abort a program, hold 
  1412. down the CONTROL key; and while you keep holding down the CONTROL 
  1413. key, tap the C key.
  1414.                                          If the computer is 
  1415. printing on the screen faster than you can read, you can make the 
  1416. computer slow down. To slow the printing, type this command:
  1417. speed=0
  1418.                                          For example, to make the 
  1419. computer LIST your program slowly, and also PRINT slowly when it 
  1420. runs your program, type this:
  1421. speed=0
  1422. list
  1423. run
  1424.                                          To make the computer 
  1425. print quickly again, at full speed, type this command:
  1426. speed=255
  1427.                                          SPEED=0 means slow; 
  1428. SPEED=255 means fast. For an intermediate speed, pick a number 
  1429. between 0 and 255.
  1430.  
  1431.                                               Save on disk (page 336)
  1432.                                          If you buy a blank disk 
  1433. and want your computer to use it, you must turn the blank disk 
  1434. into an Apple disk.
  1435.                                          To do that, turn the 
  1436. computer off, make sure the built-in drive contains the ``Systems 
  1437. Utilities ProDOS disk'', close the door, then turn the computer 
  1438. back on.
  1439.                                          The screen will 
  1440. eventually show you the main menu, which looks like this:
  1441. 1.  Copy files
  1442. 2.  Delete files
  1443. 3.  Rename files
  1444. 4.  Lock/unlock files
  1445. 5.  Duplicate a disk
  1446. 6.  Format a disk
  1447. 7.  Identify and catalog a disk
  1448. 8.  Advanced operations
  1449. 9.  Exit system utilities
  1450. Tap the 6 key, then tap the RETURN key four times.
  1451.                                          The computer will say:
  1452. Place the disk you wish to format in the built-in drive.
  1453. Press RETURN to continue.
  1454. Obey the computer: put the blank disk into the built-in drive, 
  1455. then press the RETURN key.
  1456.                                          The computer will grunt 
  1457. several times loudly: hold your ears! 20 seconds later, the 
  1458. computer will say:
  1459. Format complete.
  1460. Press RETURN to continue, ESC to return to the main menu.
  1461. The blank disk has been turned into an Apple disk.
  1462.   Press the ESC key. You'll see the main menu again. Tap the 9 
  1463. key, then tap the RETURN key twice. Then tap the ESC key, 
  1464. followed by the 4 key (for fat characters) or the 8 key (for thin 
  1465. characters).
  1466.   You cannot copy a program onto the System Utilities ProDOS 
  1467. disk. Instead, copy your program onto a blank disk that you 
  1468. turned into an Apple disk.
  1469.   Omit quotation marks.
  1470. Most computers:  SAVE "JOE"
  1471. Your computer:   save joe
  1472.   Instead of saying FILES, say CATALOG or CAT. If you say CAT, 
  1473. the computer will print an abridged catalog.
  1474.   How to use drive 2 The built-in drive is called drive 1. If you 
  1475. buy an extra drive, the extra is called the external drive; it's 
  1476. also called drive 2.
  1477.   Normally, the computer uses drive 1. If you want it to use 
  1478. drive 2 instead, put a comma and a D2 at the end of the disk 
  1479. command. For example, to get a catalog of drive 2, say:
  1480. catalog,d2
  1481. To save JOE in drive 2, say:
  1482. save joe,d2
  1483.   If you put a comma and D2 at the end of a command, the Apple 
  1484. assumes you're more interested in drive 2 than in drive 1. 
  1485. Therefore, it will automatically use drive 2 instead of drive 1 
  1486. for all future commands. If you ever want to use drive 1 again, 
  1487. you must give a command that ends in a comma and D1.
  1488.   How to copy an entire disk To copy an entire disk, put the 
  1489. System Utilities ProDOS disk into the built-in drive. Turn the 
  1490. computer off, then on again. When you see the main menu, tap the 
  1491. 5 key, then tap the RETURN key three times.
  1492.   The computer will say:
  1493. Place the source disk in the built-in drive.
  1494. Press RETURN to continue.
  1495. Obey the computer: into the built-in drive, put the disk you want 
  1496. to copy; then press the RETURN key.
  1497.   The computer will say:
  1498. Place the destination disk into the built-in drive.
  1499. Press RETURN to continue.
  1500. Obey the computer: into the built-in drive, put a blank disk; 
  1501. then press the RETURN key twice.
  1502.   The computer will turn the blank disk into an Apple disk. Then 
  1503. it will say, ``Place the source disk into the built-in drive.'' 
  1504. Into the built-in drive, put the disk you want to copy; then 
  1505. press the RETURN key. Then it will say, ``Place the destination 
  1506. disk into the built-in drive.'' Grab the blank disk that you had 
  1507. just turned into an Apple disk, and put it into the built-in 
  1508. drive; then press the RETURN key.
  1509.   Seven more times, the computer will tell you to place the 
  1510. source disk and then the destination disk into the built-in 
  1511. drive. Obey the computer: swap the disks seven more pairs of 
  1512. times, and press the RETURN key after each time.
  1513.   Finally, the computer will say:
  1514. Disk copy complete.
  1515. Press RETURN to continue, ESC to return to the main menu.
  1516. Press the ESC key. You'll see the main menu. Tap the 9 key, then 
  1517. the RETURN key twice, then say how wide you want the characters 
  1518. to be (by tapping ESC then 4, or ESC then 8).
  1519.                                          How to create a 
  1520. quick-start disk To create a quick-start disk (which helps start 
  1521. using BASIC faster), get a blank disk, and turn it into an Apple 
  1522. disk (by using the System Utilities ProDOS disk). Then get the 
  1523. main menu on the screen again, and make sure the System Utilities 
  1524. ProDOS disk is in the main drive. With the main menu still on the 
  1525. screen, tap the 1 key, tap the RETURN key four times, tap the 
  1526. down-arrow key six times, tap the right-arrow key, tap the 
  1527. down-arrow key again, tap the right-arrow key again, and tap the 
  1528. RETURN key.
  1529.                                          The computer will say:
  1530. Place the destination disk in the built-in drive.
  1531. Press RETURN to continue.
  1532. Obey the computer: put the blank Apple disk into the built-in 
  1533. drive, then press the RETURN key. The computer will tell you to 
  1534. swap disks four more times. Finally, the computer will say:
  1535. Copying complete.
  1536. Press RETURN to continue, ESC to return to the main menu.
  1537. Press the ESC key. You'll see the main menu. Tap the 9 key, then 
  1538. the RETURN key twice, then say how wide you want the characters 
  1539. to be (by tapping ESC then 4, or ESC then 8).
  1540.                                          You've created a 
  1541. quick-start disk. In the future, whenever you want to start using 
  1542. the computer quickly, put the quick-start disk into the drive 
  1543. (instead of the System Utilities ProDOS disk), and then turn on 
  1544. the computer. The computer will say:
  1545. PRODOS BASIC
  1546. ]
  1547. Then just say how wide you want the characters to be (by tapping 
  1548. ESC then 4, or ESC then 8).
  1549.                                          If you save a program on 
  1550. that disk, and call the program STARTUP (instead of JOE), the 
  1551. computer will automatically run that program whenever you start 
  1552. up the computer.
  1553.                                          If you make the top two 
  1554. lines of that program say ___ 
  1555. 10 d$=chr$(4)
  1556. 11 ?d$"pr#3"
  1557. the computer will automatically tap the ESC key and 8 key for 
  1558. you.
  1559.                                          Apple 2e To turn a blank 
  1560. disk into an Apple disk, turn the computer off, make sure drive 1 
  1561. contains the ProDOS User's Disk, close the door, and turn the 
  1562. computer back on. The computer will say PRODOS USER'S DISK. Tap 
  1563. the F key; the computer will say FILER. Tap the V key; the 
  1564. computer will say VOLUME COMMANDS. Tap the F key; put the blank 
  1565. disk into drive 1; press the RETURN key three times; the computer 
  1566. will say FORMATTING. 25 seconds later, the computer will say 
  1567. FORMAT COMPLETE; the blank disk has been turned into an Apple 
  1568. disk. Press the ESC key twice, then the Q key, then the RETURN 
  1569. key.
  1570.                                          To copy an entire disk, 
  1571. put the ProDOS User's Disk into drive 1. Turn the computer off, 
  1572. then on again. The computer will say PRODOS USER'S DISK. Tap the 
  1573. F key; the top of the screen will say FILER. Tap the V key; the 
  1574. top of the screen will say VOLUME COMMANDS. Tap the C key; grab 
  1575. the disk you want to copy, and put it in drive 1; put a blank 
  1576. disk in drive 2; press the RETURN key six times. When the 
  1577. computer finishes copying, press the ESC key twice, then the Q 
  1578. key, then the RETURN key.
  1579.   Apple 2 and 2+ To turn a blank disk into an Apple disk, put the 
  1580. blank disk into drive 1 and then type:
  1581. NEW
  1582. 10 PRINT "HELLO"
  1583. INIT HELLO
  1584. The drive's red light will glow for about 30 seconds. When it 
  1585. stops glowing, your blank disk is finally an Apple disk; it's 
  1586. called a ``slave of a DOS 3.3 System Master''. It's also a 
  1587. quick-start disk.
  1588.   Your computer doesn't understand CAT: say CATALOG.
  1589.   To copy an entire disk, put the DOS 3.3 System Master disk into 
  1590. drive 1. Type RUN COPYA and press the RETURN key. The computer 
  1591. will say APPLE DISKETTE DUPLICATION PROGRAM. Grab the disk you 
  1592. want to copy, and put it in drive 1; put a blank disk in drive 2; 
  1593. press the RETURN key five times. The computer will copy all 
  1594. information from drive 1's disk to the blank disk. (In the 
  1595. process, it will also turn the blank disk into an Apple disk.) 
  1596. Then the computer will ask DO YOU WANT TO MAKE ANOTHER COPY? If 
  1597. you don't, type an N and then press the RETURN key.
  1598.  
  1599.    How to choose a name (page 337)
  1600.   Your program's name can be short (such as JOE) or long: up to 
  1601. 15 characters. The name's first character must be a letter; the 
  1602. remaining characters must be letters, digits, or periods.
  1603.  
  1604.       Load from disk (page 337)
  1605.   Omit quotation marks.
  1606. Most computersYour computer
  1607. LOAD "JOE"  load joe
  1608. RUN "JOE"   run joe
  1609.  
  1610.       Edit the disk (page 337)
  1611.   Instead of saying RENAME ``JOE'' TO ``FRED'', say:
  1612. rename joe,fred
  1613.  
  1614.     Space on the disk (page 337)
  1615.   To erase JOE from the disk, instead of saying KILL ``JOE'' say:
  1616. delete joe
  1617.  
  1618.           Tapes (page 337)
  1619.   The Apple 2c can't handle tapes.
  1620.  
  1621.    Long variable names (page 340)
  1622.   Variable names must be short. The name of a numeric variable 
  1623. must be just 1 or 2 characters; the name of a string variable 
  1624. must be just 1 or 2 characters followed by a dollar sign. If you 
  1625. try to make the variable's name longer than that, the computer 
  1626. will handle it unreliably.
  1627.   If you want a variable name that's 2 characters long, avoid the 
  1628. following 2-character names, which have special meanings: TO, IF, 
  1629. ON, FN, GR, AT, OR.
  1630.                                                  INPUT (page 341)
  1631.                                          In the INPUT statement, 
  1632. the computer's question is called the prompt. The prompt begins 
  1633. and ends with a quotation mark. On your computer, the prompt 
  1634. should end with a question mark then a space then a quotation 
  1635. mark. . . . 
  1636. Most computers:                                  10 INPUT "WHAT 
  1637. IS YOUR NAME";N$
  1638. Your computer:                                   10 input "What 
  1639. is your name? ";n$
  1640.                                          Usually, you can abort a 
  1641. program by tapping the C key while holding down the CONTROL key. 
  1642. But while the computer is doing an INPUT statement, that method 
  1643. won't work, unless you press the RETURN key afterwards.
  1644.  
  1645.                                             Fancy relations (page 349)
  1646.                                          Your computer can't 
  1647. handle the letter A followed by the word THEN. For example, it 
  1648. can't handle:
  1649. if x=a then print "wow"
  1650.                                          To prevent the letter A 
  1651. from being next to THEN, reverse the equality ___ 
  1652. if a=x then print "wow"
  1653. or use parentheses to separate the A from the THEN:
  1654. if (x=a) then print "wow"
  1655.  
  1656.                                                   ELSE (page 349)
  1657.                                          Your computer doesn't 
  1658. understand the word ELSE.
  1659.  
  1660.                                              FOR . . . NEXT (page 355)
  1661.                                          If you indent the lines 
  1662. between FOR and NEXT, your computer ignores the indentation. When 
  1663. you LIST your program, you won't see any indentation. So don't 
  1664. bother to indent.
  1665.  
  1666.                                               Renumbering (page 367)
  1667.                                          Your computer doesn't 
  1668. understand RENUM.
  1669.  
  1670.                                              The PAUSE key (page 367)
  1671.                                          Your keyboard lacks a 
  1672. PAUSE key. To make the computer pause, hold down the CONTROL key; 
  1673. and while you keep holding down the CONTROL key, tap the S key.
  1674.                                          To stop pausing, press 
  1675. the SPACE bar.
  1676.  
  1677.                                                Apostrophe (page 367)
  1678.                                          Instead of an 
  1679. apostrophe, type a colon followed by the word REM (which stands 
  1680. for ``remark''). For example:
  1681. 40 c=40: rem because Russ has 40 computers
  1682.  
  1683.                                                  Zones (page 368)
  1684.                                          If you chose 80 
  1685. characters per line (by tapping ESC and then 8), your screen has 
  1686. 5 zones, and each zone is 16 characters wide.
  1687.                                          If you chose 40 
  1688. characters per line (by tapping ESC and then 4), your screen has 
  1689. just 3 zones. The left zone is 16 characters wide; the middle 
  1690. zone is also 16 characters wide; the right zone is just 8 
  1691. characters wide.
  1692.     LOCATE (page 371)
  1693.   Your computer doesn't understand the word LOCATE. To print 
  1694. ``DROWN'' beginning at line 3's 7th position, say this:
  1695. vtab 3: htab 7: print "DROWN"
  1696.  
  1697.     Pixels (page 372)
  1698.   Apple handles pixels differently from most other computers. 
  1699. Here are the details. . . . 
  1700.   Simple graphics To use simple, low-resolution graphics, type:
  1701. gr
  1702. That makes the computer split the screen into two parts. The top 
  1703. part of your screen will be used for graphics. The bottom of your 
  1704. screen will not be used for graphics: instead, it will be used 
  1705. for non-graphics (which Apple calls ``text'').
  1706.   When you type GR, the computer makes the top part of your 
  1707. screen (the graphics part) be entirely black.
  1708.   Your next step is to choose a color to draw in. You can choose 
  1709. these colors:
  1710.  0. black
  1711.  1. magenta (purplish red)
  1712.  2. dark blue
  1713.  3. lavender (light purple)
  1714.  4. dark green
  1715.  5. gray
  1716.  6. blue (light greenish blue)
  1717.  7. light blue
  1718.  8. brown
  1719.  9. orange
  1720. 10. gray
  1721. 11. pink
  1722. 12. green
  1723. 13. yellow
  1724. 14. aqua (light greenish blue)
  1725. 15. white
  1726. You must also choose which pixel you want to color: the pixel's X 
  1727. and Y coordinates must each be from 0 to 39. For example, to make 
  1728. pixel (31,37) become pink, type this:
  1729. color=11: plot 31,37
  1730.   To make pixel (5,9) and pixel (17,21) both become yellow, type 
  1731. this:
  1732. color=13: plot 5,9: plot 17,21
  1733.   If the colors on your TV look wrong, adjust your TV's COLOR and 
  1734. TINT dials.
  1735.   To draw a green horizontal line from pixel (4,19) to pixel 
  1736. (8,19), type this:
  1737. color=12: hlin 4,8 at 19
  1738.   To draw a blue vertical line from pixel (4,20) to pixel (4,30), 
  1739. type this:
  1740. color=6: vlin 20,30 at 4
  1741.  
  1742.                              To print ``welcome to the art 
  1743. museum'' on the bottom part of the screen (which is for 
  1744. non-graphics), just say:
  1745. print "welcome to the art museum"
  1746.                              Whenever you want to stop using 
  1747. graphics, type:
  1748. text: home
  1749. That tells the computer to use the entire screen for non-graphics 
  1750. (TEXT).
  1751.                              You can put all those ideas into a 
  1752. program, like this:
  1753. 10 home: gr
  1754. 20 color=11: plot 31,37
  1755. 30 color=13: plot 5,9: plot 17,21
  1756. 40 color=12: hlin 4,8 at 19
  1757. 50 color=6: vlin 20,30 at 4
  1758. 60 print "welcome to the art museum"
  1759. 70 for i = 1 TO 4000: next
  1760. 80 text: home
  1761. Line 10 includes the word HOME, to make sure that the bottom part 
  1762. of the screen (for non-graphics) begins entirely black. Lines 
  1763. 20-50 draw a picture. Line 60 prints a caption. Line 70 makes the 
  1764. computer count to 4000: while the computer counts, you can admire 
  1765. the picture that the computer drew; if you want to admire the 
  1766. picture longer, change the 4000 to 10000. Line 80 returns the 
  1767. computer to its normal state, which is non-graphics.
  1768.                              In that program, lines 10, 70, and 
  1769. 80 are particularly important. Every low-resolution graphics 
  1770. program should begin by saying ``HOME: GR'', and should end by 
  1771. saying ``FOR I'' and ``TEXT: HOME''.
  1772.                              High-resolution graphics 
  1773. High-resolution graphics differs from low-resolution graphics in 
  1774. the following ways . . . 
  1775.                              For low-res, you say ``GR''. For 
  1776. high-res, you say ``HGR: VTAB 21''.
  1777.                              for low-res, you say ``COLOR='' and 
  1778. choose a color from 0 to 15. For high-res, you say ``HCOLOR='' 
  1779. and choose one of these high-res colors:
  1780. 0. black
  1781. 1. usually green;                    blackif X is even;white if 
  1782. adjacent pixel isn't black
  1783. 2. usually purple;                   blackif X is odd;white if 
  1784. adjacent pixel isn't black
  1785. 3. usually white;                    greenif X is oddand adjacent 
  1786. pixel is black;
  1787.                                      purpleif X is evenand 
  1788. adjacent pixel is black
  1789. 4. black
  1790. 5. usually orange;                   blackif X is even;white if 
  1791. adjacent pixel isn't black
  1792. 6. usually blue;                     blackif X is odd;white if 
  1793. adjacent pixel isn't black
  1794. 7. usually white;                    orangeif X is oddand 
  1795. adjacent pixel is black;
  1796.                                      blueif X is evenand adjacent 
  1797. pixel is black
  1798.                              For low-res, you say ``PLOT''. For 
  1799. high-res, you say ``HPLOT''.
  1800.                              For low-res, the X coordinate and Y 
  1801. coordinate each go from 0 to 39. For high-res, the X coordinate 
  1802. goes from 0 to 279, and the Y coordinate goes from 0 to 159.
  1803.                              For low-res, you say ``HLIN'' to 
  1804. draw a horizontal line, and you say ``VLIN'' to draw a vertical 
  1805. line. For high-res, you can draw a line in any direction, by 
  1806. saying ``HPLOT TO''. For example, if you say ___ 
  1807. hplot 250,140
  1808. hplot to 70.90
  1809. hplot to 180,114
  1810. the computer will plot the pixel (250,140), then draw a diagonal 
  1811. line from there to pixel (70,90), then draw a diagonal line from 
  1812. pixel (70,90) to pixel (180,114). You can combine those commands 
  1813. into a single command:
  1814. hplot 250,140 to 70,90 to 180,114
  1815.                              Here's a complete program:
  1816. Use high-res.                        10 home: hgr: vtab 21
  1817. Draw green lines.                    20 hcolor=1: hplot 250,140 
  1818. to 70,90 to 180,114
  1819. Write a caption.                     30 print "welcome to the art 
  1820. museum"
  1821. Pause.                               40 for i = 1 to 4000: next
  1822. End the graphics.                    50 text: home
  1823.  
  1824.                                     Advanced commands (and page #)
  1825.                              BEEP (page 373). Instead of saying 
  1826. BEEP, say:
  1827. print chr$(7);
  1828.                              SOUND (373). Your computer doesn't 
  1829. understand the word SOUND.
  1830.                              PLAY (374). Your computer doesn't 
  1831. understand the word PLAY.
  1832.                              PRINT USING (374). Your computer 
  1833. doesn't understand PRINT USING.
  1834.   Exponents (384). Your computer makes a mistake when handling 
  1835. exponents.
  1836.   According to  mathematicians  and most other computers, -52 
  1837. means ``the negative of 52''; so it's -25. But the Apple makes 
  1838. the mistake of thinking that -52 means ``the square of -5'', 
  1839. which is 25.
  1840.   If you say PRINT -5^2, the Apple will therefore print 25, which 
  1841. mathematicians consider to be wrong.
  1842.   For another example, suppose you say:
  1843. 10 x=5
  1844. 20 print -x^2
  1845. The Apple mistakenly thinks that line 20 means ``the square of 
  1846. -X'', and therefore prints 25. (According to mathematicians and 
  1847. other computers, line 20 means ``the negative of X2'', and so the 
  1848. answer ought to be -25.)
  1849.   The Apple's mistake makes the Apple incorrectly handle several 
  1850. branches of mathematics. For example, the Apple incorrectly 
  1851. solves quadratic equations and incorrectly graphs upside-down 
  1852. parabolas ___ unless you help your Apple by typing parentheses.
  1853.   To help your Apple, type parentheses whenever a minus sign is 
  1854. followed by an exponentiated number:
  1855. print -(5^2)
  1856. Another example:
  1857. 10 x=5
  1858. 20 print -(x^2)
  1859. Those parentheses make the Apple print the correct answer, which 
  1860. is -25.
  1861.   Random integers (388). Omit the word RANDOMIZE. To get a random 
  1862. integer from 1 to 5, instead of saying RND(5), say 
  1863. 1+INT(RND(1)*5).
  1864.   Random decimals (391). For a random decimal between 0 and 1, 
  1865. say RND(1) instead of just RND.
  1866.   Left, right, middle (394). Your computer doesn't understand an 
  1867. equal sign after MID$.
  1868.   Searching in a string (395). Your computer doesn't understand 
  1869. INSTR.
  1870.   Clock (395). Your computer doesn't have a clock, and so it 
  1871. doesn't understand TIME$, TIMER, or DATE$.
  1872.   String-number conversion (395). Your computer makes STR$(81.4) 
  1873. be the string ``81.4'', without a blank space.
  1874.   Repeating characters (395). Your computer doesn't understand 
  1875. STRING$.
  1876.   Types of numbers (397). You can't use double-precision. To 
  1877. create a real number, you can type as many digits as you wish, 
  1878. but the computer remembers just the first 10 digits accurately, 
  1879. and prints just the first 9 of them on your screen.
  1880.   RAM consumption (397). Each real number consumes 5 bytes of 
  1881. RAM.
  1882.   Variables (397). For integer variables, you can use the symbol 
  1883. % but not the word DEFINT.
  1884.   Adjacent printing (407). You can't put a semicolon immediately 
  1885. after INPUT.
  1886.   LINE INPUT (407). You can't say LINE INPUT.
  1887.   INPUT$ (407). Instead of saying A$=INPUT$(1), say GET A$. 
  1888. Instead of saying ___ 
  1889. 6 P$=INPUT$(4)
  1890. say:
  1891. 6 get p1$: get p2$: get p3$: get p4$: p$=p1$+p2$+p3$+p4$
  1892.   Joystick (408). Say PDL instead of STICK. If you say PDL and 
  1893. then suddenly say PDL again, the computer won't compute the 
  1894. second PDL accurately. To improve the accuracy, make the computer 
  1895. pause before the second PDL, by inserting a FOR . . . NEXT loop:
  1896. 100 x=pdl(0): for i = 1 TO 100: next: y=pdl(1)
  1897.   Mouse (408). Your computer's version of BASIC is not designed 
  1898. to work with a mouse.
  1899.   SWAP (409). Your computer doesn't understand SWAP, so use the 
  1900. alternative.
  1901.   ON ERROR GO TO (414). Change ERROR to ERR, and change ``ON 
  1902. ERROR GO TO 0'' to ``POKE 216,0''.
  1903.   You can say RESUME, but you cannot put a number or word after 
  1904. RESUME. You cannot say RESUME 30; you cannot say RESUME NEXT.
  1905.   Instead of saying RESUME 30, say ``CALL 62248: GO TO 30''.
  1906.                                          POKE (414). Normally, 
  1907. the computer uses the whole screen. If you say ___ 
  1908. poke 33,20
  1909. the computer will use just the left part of the screen. That part 
  1910. will be 20 characters wide. Whenever you try to type more than 20 
  1911. characters on a line, the computer will put the excess characters 
  1912. underneath, as part of the line below. The rightmost part of the 
  1913. screen will be unused, and will act as a very wide right margin.
  1914.                                          If you don't like a 
  1915. width of 20, choose a different width instead.
  1916.                                          Problem: write a program 
  1917. that puts instructions on the screen and keeps the instructions 
  1918. there permanently, while the rest of the screen changes. 
  1919. Solution: turn on the computer, avoid saying POKE, write the 
  1920. instructions on the rightmost part of the screen (by giving 
  1921. ordinary PRINT statements with TAB or HTAB), and then say ``POKE 
  1922. 33,20''. That POKE prevents the computer from typing anything new 
  1923. on the rightmost part of the screen ___ but the instructions you 
  1924. typed there previously will remain.
  1925.                                          Apple's LIST command is 
  1926. peculiar. To edit your program more easily, instead of saying 
  1927. just LIST, say:
  1928. poke 33,33
  1929. list
  1930. That makes the LIST be just 33 characters wide. That particular 
  1931. width ___ 3 characters ___ makes the LIST easier to edit.
  1932.                                          OPEN FOR OUTPUT (415). 
  1933. This program prints ``eat'' and 4 and ``eggs'' onto a disk file 
  1934. called SUE:
  1935. 5 d$=chr$(4): ?d$"open sue": ?d$"write sue"
  1936. 10 print "eat"
  1937. 20 print 2+2
  1938. 30 print "eggs"
  1939. 40 ?d$"close"
  1940.                                          OPEN FOR INPUT (415). 
  1941. This program makes the computer read SUE and copy it to your 
  1942. screen:
  1943. 5 d$=chr$(4): ?d$"open sue": ?d$"read sue"
  1944.  
  1945. 10 input a$
  1946. 11 print a$
  1947.  
  1948. 20 input b
  1949. 21 print b
  1950.  
  1951. 30 input c$
  1952. 31 print c$
  1953.  
  1954. 40 ?d$"close"
  1955.                                          OPEN FOR APPEND (415). 
  1956. This program makes the computer append ``good morning!'' to the 
  1957. end of SUE:
  1958. 10 d$=chr$(4): ?d$"open sue": ?d$"append sue"
  1959. 20 print "good morning!"
  1960. 30 ?d$"close"
  1961.                                          Loops (416). Your 
  1962. computer doesn't understand EOF(1). Instead of saying IF EOF(1) 
  1963. THEN GO TO 1000, put this line at the top of your program: ON ERR 
  1964. GO TO 1000.
  1965.                                          LOF (416). Your computer 
  1966. doesn't understand LOF(1).
  1967.                                          PUT (417). This program 
  1968. creates a random-access file called JIM whose record length is 
  1969. 21, and defines JIM's 7th, 9th, and 4th items:
  1970. 5 d$=chr$(4): ?d$"open jim,l21"
  1971. 10 ?d$"write jim,r" 7: print "love makes me giggle"
  1972. 20 ?d$"write jim,r" 9: print "please hold my hand"
  1973. 30 ?d$"write jim,r" 4: print "I love Lucy"
  1974. 40 ?d$"close"
  1975.                                          At the end of line 5, 
  1976. the L21 means Length 21. ``LOVE MAKES ME GIGGLE'' contains 20 
  1977. characters but requires a record length of 21, because the RETURN 
  1978. key at the end of GIGGLE consumes 1 byte.
  1979.                                          GET (417). This program 
  1980. makes the computer tell you JIM's 7th item:
  1981. 5 d$=chr$(4): ?d$"open jim,l21"
  1982. 10 ?d$"read jim,r" 7: input x$: print x$
  1983. 20 ?d$"close"
  1984.                                          LOC (417). Your computer 
  1985. doesn't understand LOC.
  1986.                                          Numerical data (417). 
  1987. The computer lets you put numbers in the file. You do not have to 
  1988. convert the numbers to strings.
  1989.  
  1990.  
  1991.                     COMMODORE
  1992.   Here's how to use BASIC on the Commodore 64 computer. (The 
  1993. Commodore 64C and SX-64 are similar.) I'll explain how the 
  1994. Commodore 128, 128D, 16, Plus 4, Pet, Super Pet, CBM, and Vic-20 
  1995. differ. The Amiga resembles the Apple Mac (explained on page 
  1996. 427).
  1997.  
  1998.              The keyboard (page 324)
  1999.   On the Commodore 64, the keys are placed like this:
  2000.    ┌────────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬
  2001. ────┬────┐┌───┐
  2002.    │        │ ! │ " │ # │ $ │ % │ & │ ' │ ( │ ) │   │   │   │   
  2003. │Clr │Inst││F2 │
  2004.    │       │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ - │ £ 
  2005. │Home│Del ││F1 │
  2006.    ├────────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴
  2007. ─┬──┴────┤├───┤
  2008.    │          │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │   │   │   
  2009. │       ││F4 │
  2010.    │   Ctrl   │   │   │   │   │   │   │   │   │   │   │ @ │ * │  
  2011. │Restore││F3 │
  2012. ┌──┴─┬────────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬─
  2013. ─┴────┬──┘├───┤
  2014. │Run │         │ A │ S │ D │ F │ G │ H │ J │ K │ L │ [ │ ] │   │       
  2015. │   │F6 │
  2016. │Stop│ShiftLock│   │   │   │   │   │   │   │   │   │ : │ ; │ = 
  2017. │Return │   │F5 │
  2018. ├────┴────┬────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼─
  2019. ──┬───┤   ├───┤
  2020. │         │      │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │     │  
  2021. │  │   │F8 │
  2022. │Commodore│Shift │   │   │   │   │   │   │   │ , │ . │ / │Shift│  
  2023. │ ■ │   │F7 │
  2024. └─────────┴──────┴┬──┴───┴───┴───┴───┴───┴───┴───┴───┴┬──┴─────┴─
  2025. ──┴───┘   └───┘
  2026.                   │                                   │
  2027.                   │               Space               │
  2028.                   └───────────────────────────────────┘
  2029.   The key in the bottom left corner is called the Commodore key. 
  2030. In the diagram, I wrote the word ``Commodore'' on that key; but 
  2031. if you look at your actual Commodore 64 keyboard, you'll see a 
  2032. fancy C on that key instead.
  2033.   The zero key is Swedish.
  2034.   The computer capitalizes all letters automatically; so to type 
  2035. a capital letter, do not press the SHIFT key.
  2036.   There is no CAPS key.
  2037.   The BACKSPACE key is marked DEL (which stands for DELETE). So 
  2038. to backspace, make sure you hit the DEL key. Do not hit the keys 
  2039. that show left-arrows; the left arrow keys do not backspace 
  2040. correctly.
  2041.   The ENTER key says RETURN on it.
  2042.  
  2043.              Get started (page 325)
  2044.   The computer's power switch is on the computer's right side. 
  2045. Flip that switch ON. Then turn on the TV or monitor.
  2046.   If you're using a TV, turn it to channel 3 or 4. To switch the 
  2047. computer from channel 3 to channel 4 or back to channel 3, flip 
  2048. the computer's channel-selection switch, which is on the back of 
  2049. the computer. If the writing on the TV looks fuzzy, adjust the 
  2050. TV's fine tuning.
  2051.   Adjust the screen's brightness and contrast.
  2052.   When the computer's on and functioning correctly, the computer 
  2053. will say READY (instead of OK).
  2054.   Commodore 128 and 128D Those computers resemble a Commodore 
  2055. Plus 4 until you say ___ 
  2056. GO 64
  2057. which makes them imitate a Commodore 64 instead.
  2058.  
  2059.                  Math (page 326)
  2060.   To type a plus sign, do not press the SHIFT key. (If you 
  2061. accidentally press the SHIFT key, you'll be typing a crucifix 
  2062. instead of a plus sign.)
  2063.  
  2064.     Long commands on small screens (page 328)
  2065.   A command can contain up to 80 characters. If you try to type 
  2066. more than 80 characters in a command, the computer will ignore 
  2067. the extra characters.
  2068.  
  2069.                 Colons (page 329)
  2070.   Although you can put several statements on the same line, the 
  2071. total number of characters in the line must not be greater than 
  2072. 80.
  2073.                                                         Ranges of lines
  2074.                                                           (page 332)
  2075.                                                      Your 
  2076. computer does not understand the word DELETE. To delete lines 30, 
  2077. 31, 32, 33, and 34, you cannot type DELETE 30-34; instead, you 
  2078. must type:
  2079. 30
  2080. 31
  2081. 32
  2082. 33
  2083. 34
  2084.  
  2085.                                                      Arrow keys (page 332)
  2086.                                                      To edit line 
  2087. 30, first put line 30 onto the screen, by saying LIST 30. (Say 
  2088. LIST, not EDIT: your computer doesn't understand the word EDIT.)
  2089.                                                      At the 
  2090. keyboard's lower-right corner, you'll see a pair of arrow keys. 
  2091. By pressing them with or without the SHIFT key, you can move the 
  2092. cursor in all four directions. Move the cursor to the part of 
  2093. line 30 you want to correct, then make your corrections.
  2094.                                                      To delete a 
  2095. character, move the cursor just past that character, then press 
  2096. the DELETE key. The DELETE key deletes the character to the left 
  2097. of the cursor.
  2098.                                                      To replace a 
  2099. character, move the cursor to the character you want to replace, 
  2100. then type the new character you want instead.
  2101.                                                      To insert an 
  2102. extra character in the middle of the line, move the cursor to 
  2103. where you want that character to appear, then tap the INST key 
  2104. while holding down the SHIFT key, then type the character you 
  2105. want to insert. (To insert two characters, you must tap the INST 
  2106. key with SHIFT, then type the first character, then tap the INST 
  2107. key with SHIFT again, then type the second character.)
  2108.                                                      When you've 
  2109. finished correcting the line, press the RETURN key, which tells 
  2110. the computer to take the corrections seriously.
  2111.                                                      After 
  2112. pressing the RETURN key, you might like to move the cursor to the 
  2113. bottom of the screen. If you'd like to do that, press the 
  2114. down-arrow key several times.
  2115.   Hassle That editing procedure is easy, except for one hassle: 
  2116. under certain unusual conditions, the cursor keys and INST/DEL 
  2117. key don't work! Under those conditions, the cursor keys and 
  2118. INST/DEL keys print strange symbols on your screen instead of 
  2119. moving the cursor. If that happens to you, press the RETURN key 
  2120. and then try again to edit the line. If it happens again, press 
  2121. the RETURN key, then move the cursor to the bottom of the screen, 
  2122. and type the whole line over again.
  2123.   I said the hassle occurs ``under certain unusual conditions''. 
  2124. Specifically, it occurs only if you begin an editing sequence (by 
  2125. pressing the cursor keys and INST/DEL key) when you're at the 
  2126. right-hand part of a line: the part that's to the right of an 
  2127. unmatched quotation mark or to the right of an inserted space 
  2128. (inserted by the INST key).
  2129.  
  2130.      Clear the screen (page 333)
  2131.   The CLEAR key is marked ``CLR HOME''. To clear the screen, hold 
  2132. down the SHIFT key; and while you keep holding down the SHIFT 
  2133. key, press the ``CLR HOME'' key.
  2134.   Your computer does not understand CLS. To make line 10 clear 
  2135. the screen, type this instead:
  2136. 10 PRINT "";
  2137. To make that heart, hold down the SHIFT key with the CLR HOME 
  2138. key.
  2139.  
  2140.       Print on paper (page 333)
  2141.   Your keyboard doesn't have a PRINT key or ECHO key, and your 
  2142. computer doesn't understand LPRINT or LLIST. To print on paper, 
  2143. here's what to do instead. . . . 
  2144.   Make sure the printer is plugged in, turned on, and full of 
  2145. paper. Make sure any lights indicating POWER, READY, SELECT, and 
  2146. ON LINE are glowing.
  2147.   To activate the printer, type this:
  2148. OPEN 4,4: CMD 4
  2149. That makes the computer use paper instead of your screen. 
  2150. Henceforth, the computer will print all its answers on paper 
  2151. instead of on your screen.
  2152.   If you ever want the computer to print on your screen again, 
  2153. you must deactivate the printer, by typing:
  2154. PRINT#4: CLOSE 4
  2155.   For example, to make the computer print just ``I LOVE YOU'' on 
  2156. paper, you must activate the printer, then tell the computer to 
  2157. print ``I LOVE YOU'', then deactivate the printer, like this:
  2158. OPEN 4,4: CMD 4
  2159. PRINT "I LOVE YOU"
  2160. PRINT#4: CLOSE 4
  2161.   If a program prints on the screen but you want it to print on 
  2162. paper instead, activate the printer before you type RUN. Here's 
  2163. how:
  2164. OPEN 4,4: CMD 4
  2165. RUN
  2166. PRINT#4: CLOSE 4
  2167.   Here's a fancy program that prints two poems. It prints ``LOVE 
  2168. IS LIKE A DOVE'' on your screen, and prints ``LIFE IS FULL OF 
  2169. STRIFE'' on paper:
  2170. NEW
  2171. 10 PRINT "LOVE"
  2172. 20 PRINT "IS LIKE A DOVE"
  2173. 30 OPEN 4,4: CMD 4
  2174. 40 PRINT "LIFE"
  2175. 50 PRINT "IS FULL OF STRIFE"
  2176. 60 PRINT#4: CLOSE 4
  2177. RUN
  2178.                                          To LIST your program on 
  2179. paper instead of on your screen, type this:
  2180. OPEN 4,4: CMD 4
  2181. LIST
  2182. PRINT#4: CLOSE 4
  2183.  
  2184.                                                  GO TO (page 334)
  2185.                                          The BREAK key is marked 
  2186. ``RUN STOP''. So to abort a program, press the ``RUN STOP'' key.
  2187.                                          If the computer is 
  2188. printing on the screen too quickly for you read, you can make the 
  2189. computer print more slowly. To slow the printing, hold down the 
  2190. CTRL key while the computer prints. The computer will print 
  2191. slowly, as long as you keep holding down the CTRL key. When you 
  2192. lift your finger from that key, the computer will print quickly 
  2193. again.
  2194.  
  2195.                                               Save on disk (page 336)
  2196.                                          When you flip the disk 
  2197. drive's power switch, you create an electrical surge that damages 
  2198. any disk inside the drive. So before flipping the drive's power 
  2199. switch, make sure the drive is empty.
  2200.                                          So to turn on your 
  2201. computer system, first remove any disk from the drive; then flip 
  2202. on the drive's switch; then turn on the computer. Memorize that 
  2203. sequence: ``disks out, drive on, computer on.''
  2204.                                          When you're done using 
  2205. the computer, follow this sequence: ``disks out, computer off, 
  2206. drive off''.
  2207.                                          How to insert a disk To 
  2208. put a disk into the drive, first make sure the disk drive's red 
  2209. light is off. Then open the drive's door.
  2210.                                          Insert the disk into the 
  2211. drive. When you insert it, make sure the disk's label is on top 
  2212. of the disk, and make sure the disk's big oval cutout goes into 
  2213. the drive before the label does. Close the drive's door.
  2214.                                          How to turn a blank disk 
  2215. into a Commodore disk If you buy a blank disk and want your 
  2216. computer to use it, you must turn the blank disk into a Commodore 
  2217. disk.
  2218.                                          To do that, insert the 
  2219. blank disk into the drive (and close the door). To name the disk 
  2220. ELIZABETH and give it ID number 00, type this:
  2221. OPEN 15,8,15,"N:ELIZABETH,00"
  2222. CLOSE 15
  2223. Each disk you create must have a different ID number. The ID 
  2224. number can be any number from 00 to 99 ___ or it can even be a 
  2225. pair of letters.
  2226.                                          The drive's red light 
  2227. will glow for about 2 minutes. When the light stops glowing, your 
  2228. blank disk is finally a Commodore disk.
  2229.                                          SAVE Instead of saying 
  2230. SAVE ``JOE'', say:
  2231. SAVE "JOE",8
  2232.                                          FILES Instead of saying 
  2233. FILES, say:
  2234. LOAD "$",8
  2235. LIST
  2236.  
  2237.   Watch the red light Whenever you give a disk command, the 
  2238. computer sends the command to the disk drive and immediately says 
  2239. READY. The word READY does not mean the drive's finished the 
  2240. command yet. The drive doesn't finish the command until the 
  2241. drive's red light stops glowing.
  2242.   If you give a wrong disk command, the computer nevertheless 
  2243. sends it to the drive and says READY. But when the drive receives 
  2244. that command, the drive gripes by blinking its red light 
  2245. repeatedly. So a repeatedly blinking light means you made an 
  2246. error. A continually glowing light means your command is okay and 
  2247. the drive is obeying it. Here's the rule: ``Blink is bad. Glow is 
  2248. good.''
  2249.   If you give a bad command and the light starts to blink, you 
  2250. must stop the blinking, by typing this:
  2251. OPEN 15,8,15,"I"
  2252. CLOSE 15
  2253.   Commodore 16, Plus 4, Pet, Super Pet, and CBM Turn a blank disk 
  2254. into a Commodore disk by saying HEADER ``ELIZABETH'',I00,D0. Save 
  2255. JOE by saying DSAVE ``JOE''. List the files on the disk by saying 
  2256. DIRECTORY (if you have a Commodore 16 or Plus 4) or CATALOG D0 
  2257. (if you have a Pet, Super Pet, or CBM).
  2258.  
  2259.    How to choose a name (page 337)
  2260.   Your program's name can be short (such as JOE) or long: up to 
  2261. 16 characters.
  2262.  
  2263.       Load from disk (page 337)
  2264.   Instead of saying LOAD ``JOE'', say this:
  2265. LOAD "JOE",8
  2266.   Instead of saying RUN ``JOE'', say this:
  2267. LOAD "JOE",8
  2268. RUN
  2269.   Commodore 16, Plus 4, Pet, Super Pet, and CBM Say DLOAD ``JOE'' 
  2270. instead of LOAD ``JOE'',8.
  2271.  
  2272.       Edit the disk (page 337)
  2273.   If you try to copy JOE onto a disk (by saying SAVE ``JOE'',8) 
  2274. and the disk already contains a program named JOE, the drive will 
  2275. gripe, by blinking its light. To avoid such griping, give this 
  2276. command instead:
  2277. SAVE "@:JOE",8
  2278. In that command, the at-sign followed by the colon tells the 
  2279. drive: save JOE, even though the disk already contains a JOE.
  2280.   Instead of saying RENAME ``JOE'' TO ``FRED'', say:
  2281. OPEN 15,8,15,"R:FRED=JOE"
  2282. CLOSE 15
  2283.   Commodore 16, Plus 4, Pet, Super Pet, and CBM You can say 
  2284. RENAME ``JOE'' TO ``FRED''.
  2285.  
  2286.     Space on the disk (page 337)
  2287.   Instead of saying KILL ``JOE'', say:
  2288. OPEN 15,8,15,"S:JOE"
  2289. CLOSE 15
  2290.   Commodore 16, Plus 4, Pet, Super Pet, and CBM Say SCRATCH 
  2291. ``JOE'' instead.
  2292.                                                  Tapes (page 337)
  2293.                                          To copy a program onto a 
  2294. tape, position the tape and notice the counter's number. Then 
  2295. type the word SAVE. At the end of that word, press the RETURN 
  2296. key.
  2297.                                          Your computer will say:
  2298. PRESS RECORD & PLAY ON TAPE
  2299. Obey the computer: press the recorder's RECORD and PLAY buttons 
  2300. at the same time as each other.
  2301.                                          The computer will say:
  2302. OK
  2303. SAVING
  2304. READY.
  2305. Then press the recorder's STOP button.
  2306.                                          How to read a program 
  2307. from a tape. Put the tape into the recorder. (To do that, you 
  2308. might have to press the recorder's EJECT button.)
  2309.                                          By using the REWIND, 
  2310. FAST FORWARD, PLAY, and STOP buttons (and the counter, if you 
  2311. have one), position the tape to the program's beginning (or 
  2312. slightly before). Then type the word LOAD. At the end of that 
  2313. word, press the RETURN key.
  2314.                                          The computer will say:
  2315. PRESS PLAY ON TAPE
  2316. Obey the computer, by pressing the recorder's PLAY button.
  2317.                                          The computer will say:
  2318. OK
  2319. SEARCHING
  2320. FOUND
  2321. LOADING
  2322. READY.
  2323. Then press the recorder's STOP button.
  2324.                                          Type the word LIST or 
  2325. RUN; then press the RETURN key.
  2326.  
  2327.                                           Long variable names (page 340)
  2328.                                          Variable names must be 
  2329. short. The name of a numeric variable must be just 1 or 2 
  2330. characters; the name of a string variable must be just 1 or 2 
  2331. characters followed by a dollar sign. If you try to make the 
  2332. variable's name longer than that, the computer will handle it 
  2333. unreliably.
  2334.                                          If you want a variable 
  2335. name that's 2 characters long, avoid the following 2-character 
  2336. names, which have special meanings: GO, TO, IF, ON, FN, TI, ST, 
  2337. OR.
  2338.  
  2339.                                                  INPUT (page 341)
  2340.                                          Usually, you can abort a 
  2341. program by pressing the RUN STOP key. But while the computer is 
  2342. doing an INPUT statement, the RUN STOP key refuses to work, 
  2343. unless you simultaneously hold down the RESTORE key.
  2344.                                          Test whether your 
  2345. Commodore 64 is old Commodore has sold two versions of the 
  2346. Commodore 64. The old version has trouble handling the INPUT 
  2347. statement; the new version handles the INPUT statement correctly. 
  2348. Commodore switched to the new version around the beginning of 
  2349. 1984. Test whether your Commodore 64 is new or old, by running 
  2350. this program:
  2351. 10 INPUT "ARE YOU THE HAPPIEST PERSON IN THE WHOLE WORLD";A$
  2352. 20 PRINT "YOU SAID ";A$
  2353.                                          When you run the 
  2354. program, and the computer asks ``ARE YOU THE HAPPIEST PERSON IN 
  2355. THE WHOLE WORLD'', answer YES. If your Commodore 64 is new and 
  2356. works correctly, it will reply:
  2357. YOU SAID YES
  2358. If your Commodore 64 is old, it will say this nonsense instead:
  2359. YOU SAID ARE YOU THE HAPPIEST PERSON IN THE WHOLE WORLD? YES
  2360.   What to do if your Commodore 64 is old In an INPUT statement, 
  2361. the computer's question is called the prompt. An old Commodore 64 
  2362. can't correctly handle a prompt longer than 38 characters. For 
  2363. example, this line's prompt's too long for an old Commodore 64:
  2364. 10 INPUT "ARE YOU THE HAPPIEST PERSON IN THE WHOLE WORLD";A$
  2365. To prevent the old Commodore 64 from printing nonsense, shorten 
  2366. the prompt to 38 characters or less, like this:
  2367. 10 INPUT "ARE YOU THE HAPPIEST PERSON";A$
  2368. Better yet, eliminate the prompt altogether and replace it by a 
  2369. PRINT statement, like this:
  2370. 10 PRINT "ARE YOU THE HAPPIEST PERSON IN THE WHOLE WORLD?"
  2371. 11 INPUT A$
  2372.   Many examples in this book contain prompts that are too long 
  2373. for an old Commodore 64 to handle. You must revise the examples 
  2374. or buy a newer computer.
  2375.   Vic-20 If you have a Vic-20 computer, you must keep the INPUT 
  2376. statement's prompt short: no longer than 20 characters.
  2377.   Pet, Super Pet, and CBM The RESTORE key is missing. Instead of 
  2378. holding down the RUN STOP and RESTORE keys simultaneously, tap 
  2379. the RETURN key.
  2380.  
  2381.      Once upon a time (page 342)
  2382.   Reminder: some of the prompts are too long for an old Commodore 
  2383. 64 to handle, so you must revise them.
  2384.  
  2385.       Numeric input (page 344)
  2386.   If your Commodore 64 is old, shorten the prompts to 38 
  2387. characters or less.
  2388.   If you forget to shorten a prompt, when you run the program and 
  2389. input a number the computer will say:
  2390. REDO FROM START
  2391. Abort the program (by holding down the RUN STOP and RESTORE keys 
  2392. simultaneously), then shorten the prompt.
  2393.  
  2394.         Therapist (page 345)
  2395.   If you try to invent your own examples using IF . . . THEN, 
  2396. make sure each line of your program contains no more than 80 
  2397. characters. You'll be tempted to make some of the IF . . . THEN 
  2398. lines be longer, but longer lines won't work.
  2399.  
  2400.            ELSE (page 349)
  2401.   Your computer doesn't understand the world ELSE.
  2402.  
  2403.      DATA . . . READ (page 350)
  2404.   If you invent your own list of data, remember that each line of 
  2405. your program must be short: no more than 80 characters!
  2406.  
  2407.       FOR . . . NEXT (page 355)
  2408.   If you indent the lines between FOR and NEXT, your computer 
  2409. ignores the indentation. When you LIST your program, you won't 
  2410. see any indentation. So don't bother to indent.
  2411.                                               Renumbering (page 367)
  2412.                                          Your computer doesn't 
  2413. understand the word RENUM.
  2414.  
  2415.                                              The PAUSE key (page 367)
  2416.                                          Your keyboard lacks a 
  2417. PAUSE key. Instead of pausing, you must either slow the computer 
  2418. down (by holding down the CTRL key) or abort (by pressing the 
  2419. STOP key).
  2420.                                          After aborting a RUN, 
  2421. you can make the computer continue where it left off, by typing:
  2422. CONT
  2423.                                          The word CONT will make 
  2424. the computer continue an aborted RUN, but will not make it 
  2425. continue an aborted LIST.
  2426.                                          Pet, Super Pet, and CBM 
  2427. The CTRL key is messing. Hold down the RVS key instead.
  2428.  
  2429.                                                Apostrophe (page 367)
  2430.                                          Instead of an 
  2431. apostrophe, type a colon followed by the word REM (which stands 
  2432. for ``remark''). For example:
  2433. 40 C=40: REM BECAUSE RUSS HAS 40 COMPUTERS
  2434.  
  2435.                                                  Zones (page 368)
  2436.                                          Your screen has 4 zones. 
  2437. Each zone is 10 characters wide, so the entire screen is 40 
  2438. characters wide.
  2439.  
  2440.                                                   TAB (page 370)
  2441.                                          On other computers, the 
  2442. leftmost character in the line is said to be at position 1. But 
  2443. on your computer, the leftmost character in the line is said to 
  2444. be at position 0 instead; after position 0 come positions 1, 2, 
  2445. 3, etc.
  2446.                                          So on your computer, if 
  2447. you say TAB(0), you'll be going to the leftmost position; if you 
  2448. say TAB(1), you will not be going to the leftmost position.
  2449.  
  2450.                                                  LOCATE (page 371)
  2451.                                          Your computer doesn't 
  2452. understand the word LOCATE. To make your computer move the 
  2453. cursor, use the following trick instead. . . . 
  2454.                                          In the middle of your 
  2455. program, write a PRINT statement that prints a string. (To do 
  2456. that, type a line number, followed by the word PRINT, followed by 
  2457. a quotation mark, followed by a string of characters, followed by 
  2458. another quotation mark.) But while you're in the middle of typing 
  2459. the string of characters, press a cursor-arrow key several times. 
  2460. When you press the cursor key, the cursor will not move 
  2461. immediately; instead, you'll see funny symbols in the middle of 
  2462. the string.
  2463.                                          Later, when you RUN the 
  2464. program and the computer comes to that PRINT statement and sees 
  2465. those funny symbols, the computer will automatically move the 
  2466. cursor.
  2467.                                          Here's the rule: while 
  2468. you're typing a string, if you try to move the cursor, the 
  2469. computer won't move the cursor until later when the program is 
  2470. running.
  2471.                                          So to write a program 
  2472. that moves the cursor, tap the cursor-arrow keys in the middle of 
  2473. a string in a PRINT statement.
  2474.  
  2475.                                                  Pixels (page 372)
  2476.                                          To make your computer 
  2477. easily handle pixels, you must insert a cartridge called Simon's 
  2478. BASIC, which costs extra. For details about how to use that 
  2479. cartridge, read the manual that comes with the cartridge.
  2480.    Advanced commands (and page #)
  2481.   Sounds (page 373). To make your computer easily produce sounds, 
  2482. you must buy the Simon's BASIC cartridge. For details about how 
  2483. to use that cartridge, read the manual that comes with the 
  2484. cartridge.
  2485.   PRINT USING (374). Your computer doesn't understand PRINT 
  2486. USING.
  2487.   Exponents (384). On the Commodore 64's keyboard, the exponent 
  2488. key is next to the RESTORE key and says ``'' instead of ``^''.
  2489.   Random integers (388). Instead of saying RANDOMIZE, say 
  2490. R=RND(0). To get a random integer from 1 to 5, instead of saying 
  2491. RND(5), say 1+INT(RND(1)*5).
  2492.   Commodore 16, Plus 4, and Pet. Say R=RND(-TI) instead of 
  2493. RANDOMIZE.
  2494.   Random decimals (391). For a random decimal between 0 and 1, 
  2495. say RND(1) instead of just RND.
  2496.   Left, right, middle (394). Your computer doesn't understand an 
  2497. equal sign after MID$.
  2498.   Searching in a string (395). Your computer doesn't understand 
  2499. INSTR.
  2500.   Clock (395). Your computer doesn't understand DATE$. It omits 
  2501. colons from the TIME$; so instead of saying TIME$=``13:45:07'', 
  2502. say TIME$=``124507''.
  2503.   Repeating characters (395). Your computer doesn't understand 
  2504. STRING$.
  2505.   Types of numbers (397). You can't use double-precision. To 
  2506. create a real number, you can type as many digits as you wish, 
  2507. but the computer remembers just the first 10 digits accurately, 
  2508. and prints just the first 9 of them on your screen.
  2509.   RAM consumption (397). Each real number consumes 5 bytes of 
  2510. RAM.
  2511.   Variables (397). For integer variables, you can use the symbol 
  2512. % but not the word DEFINT.
  2513.   Omitting the question mark (406). In the INPUT statement, you 
  2514. can't replace the semicolon by a comma.
  2515.   Adjacent printing (407). You can't put a semicolon immediately 
  2516. after INPUT.
  2517.   LINE INPUT (407). You can't say LINE INPUT.
  2518.   INPUT$ (407). Instead of saying ___ 
  2519. 20 A$=INPUT$(1)
  2520. say:
  2521. 20 GET A$: IF A$="" THEN GO TO 20
  2522.   Instead of saying INPUT$(4), you must GET one character at a 
  2523. time.
  2524.   Joystick (408). To make the computer look at joystick 1, say:
  2525. 100 J=15-(PEEK(56321) AND 15)
  2526.   If the joystick is pushed forward, J is 1. If the joystick is 
  2527. pulled back, J is 2. If the joystick is pushed to the left, J is 
  2528. 4. If the joystick is pushed to the right, J is 8.
  2529.   Combined motions produce combined numbers. For example, if the 
  2530. joystick is pushed forward and to the left simultaneously, J is 
  2531. 1+4, which is 5.
  2532.   If the joystick is untouched and centered, J is 0.
  2533.   To make the computer look at joystick 2, say:
  2534. 102 J2=15-(PEEK(56320) AND 15)
  2535.   To see the numbers J and J2 on your screen continually, add 
  2536. these lines:
  2537. 110 PRINT J,J2
  2538. 120 GO TO 100
  2539.   Mouse (408). Your computer doesn't use a mouse.
  2540.   SWAP (409). Your computer doesn't understand SWAP, so use the 
  2541. alternative.
  2542.   ON ERROR GO TO (414). Your computer doesn't understand ON ERROR 
  2543. GO TO.
  2544.   POKE (414). Your computer can display 16 colors, which are 
  2545. numbered as follows: 0=black, 1=white, 2=red, 3=cyan, 4=purple, 
  2546. 5=green, 6=blue, 7=yellow, 8=orange, 9=brown, 10=light brown, 
  2547. 11=dark gray, 12=gray, 13=light green, 14=light blue, 15=light 
  2548. gray.
  2549.   Normally, the characters on the screen are light blue (color 
  2550. 14). To choose a different character color, poke the color number 
  2551. into cell #646. For example, to create white characters, say:
  2552. POKE 646,1
  2553.  
  2554.                                          Normally, the screen's 
  2555. background color is a deep blue (color 6). To choose a different 
  2556. background color, poke the color number into cell #53281. For 
  2557. example, to make the background be red, say:
  2558. POKE 53281,2
  2559.                                          Normally, the border 
  2560. along the screen's edge is light blue (color 14). To choose a 
  2561. different border color, poke the color number into cell #53280. 
  2562. For example, to make the border be green, say:
  2563. POKE 53280,5
  2564.                                          Vic-20. On a Vic-20 
  2565. computer, colors 9 and 10 are pink, color 11 is light cyan, color 
  2566. 12 is light purple, and color 15 is light yellow. The border 
  2567. color number must be less than 8. To handle the border and 
  2568. background colors, don't use cells 53280 and 53281; instead 
  2569. compute (the color number of the background you want)*16+(the 
  2570. color number of the border you want)+8, then set C equal to that 
  2571. sum and say:
  2572. POKE 36879,C
  2573. If you omit the +8 from the formula for C, the characters will be 
  2574. inversed, so that you'll get light characters on a dark 
  2575. background, instead of dark characters on a light background.
  2576.                                          OPEN FOR OUTPUT (415). 
  2577. This program prints EAT and 4 and EGGS onto a disk file called 
  2578. SUE:
  2579. 5 OPEN 2,8,2,"SUE,S,W"
  2580. 10 PRINT#2, "EAT"
  2581. 20 PRINT#2, 2+2
  2582. 30 PRINT#2, "EGGS"
  2583. 40 CLOSE 2
  2584. Notice you must say PRINT#2, not PRINT#1. In line 5, the W tells 
  2585. the computer to Write SUE.
  2586.                                          OPEN FOR INPUT (415). 
  2587. This program makes the computer Read SUE and copy it to your 
  2588. screen:
  2589. 5 OPEN 2,8,2,"SUE,S,R"
  2590. 10 INPUT#2, A$
  2591. 11 PRINT A$
  2592. 20 INPUT#2, B
  2593. 21 PRINT B
  2594. 30 INPUT#2, C$
  2595. 31 PRINT C$
  2596. 40 CLOSE 2
  2597.                                          OPEN FOR APPEND (415). 
  2598. This program makes the computer Append ``GOOD MORNING!'' to the 
  2599. end of SUE:
  2600. 10 OPEN 2,8,2,"SUE,S,A"
  2601. 20 PRINT#2, "GOOD MORNING!"
  2602. 30 CLOSE 2
  2603.                                          Loops (416). Instead of 
  2604. saying EOF(1), say STAND64=64.
  2605.                                          LOF (416). Your computer 
  2606. doesn't understand LOF.
  2607.                                          Multiple files (416). 
  2608. The main file is called #2. The next file is called #3: say OPEN 
  2609. 3,8,3,``TOM,S,W''. You can use #2, #3, #4, etc., up to #14. You 
  2610. cannot use #1.
  2611.                                          How to CLOSE (416). 
  2612. After each CLOSE, you must put a number that says which file to 
  2613. CLOSE.
  2614.                                          PUT (417). This program 
  2615. creates a random-access file called JIM whose record length is 
  2616. 20, and defines JIM's 7th, 9th, and 4th records:
  2617. 5 OPEN 15,8,15: OPEN 2,8,2,"JIM,L,"+CHR$(20)
  2618. 10 PRINT#15, "P"CHR$(2)CHR$(7)CHR$(0)CHR$(0): PRINT#2, "LOVE
  2619.  MAKES ME GIGGLE";
  2620. 20 PRINT#15, "P"CHR$(2)CHR$(9)CHR$(0)CHR$(0): PRINT#2, "PLEA
  2621. SE HOLD MY HAND";
  2622. 30 PRINT#15, "P"CHR$(2)CHR$(4)CHR$(0)CHR$(0): PRINT#2, "I LO
  2623. VE LUCY";
  2624. 40 CLOSE 2: CLOSE 15
  2625.                                          GET (417). This program 
  2626. makes the computer tell you JIM's 7th item:
  2627. 5 OPEN 15,8,15: OPEN 2,8,2,"JIM"
  2628. 10 PRINT#15, "P"CHR$(2)CHR$(7)CHR$(0)CHR$(0): INPUT#2, X$: P
  2629. RINT X$
  2630. 20 CLOSE 2: CLOSE 15
  2631.                                          LOC (417). Your computer 
  2632. doesn't understand LOC.
  2633.                                          Numerical data (417). 
  2634. The computer lets you put numbers in the file. You do not have to 
  2635. convert the numbers to strings.
  2636.  
  2637.  
  2638.             TANDY MODEL 4
  2639.   Here's how to use BASIC on Tandy's Radio Shack TRS-80 Model 4 
  2640. computer. (The Models 4D and 4P are similar.)
  2641.  
  2642.      Microsoft BASIC (page 322)
  2643.   Tandy's Radio Shack TRS-80 Model 4 computer can handle two 
  2644. versions of BASIC. The best version, called Model 4 BASIC, 
  2645. requires a disk called Model 4 TRSDOS and BASIC Interpreter and 
  2646. requires a drive to put it in. The alternative version, called 
  2647. Model 3 BASIC, is only for people who lack a disk drive or lost 
  2648. the disk called ``Model 4 TRSDOS and BASIC Interpreter'' or want 
  2649. to run obsolete ``Model 3'' software.
  2650.   I'll assume you have the disk called ``Model 4 TRSDOS and BASIC 
  2651. Interpreter'' and a drive to put it in, so that you can run Model 
  2652. 4 BASIC.
  2653.   Here's how to use Model 4 BASIC. . . . 
  2654.  
  2655.        The keyboard (page 324)
  2656.   The keys are placed like this:
  2657.   ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐
  2658.   │ ! │ " │ # │ $ │ % │ & │ ' │ ( │ ) │   │ * │ = │     │
  2659.   │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ : │ - │Break│
  2660.   └─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┬─┘
  2661.     │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ ` │Clear│
  2662.     │   │   │   │   │   │   │   │   │   │   │ @ │     │
  2663. ┌───┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
  2664. │    │ A │ S │ D │ F │ G │ H │ J │ K │ L │ +~│       ±│
  2665. │Ctrl│   │   │   │   │   │   │   │   │   │ ;^│ Enter _│
  2666. └┬───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬──────┼─┐
  2667.  │     │ Z │ X │ C │ V │ B │ N │ M │ <{│ >}│ ?││      │ │
  2668.  │Shift│   │   │   │   │   │   │   │ ,[│ .]│ /\│Shift ││
  2669.  └─────┴───┼───┴───┴───┴───┴───┴───┴───┴───┼───┴┬─────┼─┼─┐
  2670.            │                               │    │DelLn│ │ │
  2671.            │             Space             │Caps│    ││■│
  2672.            └───────────────────────────────┴────┴─────┴─┴─┘
  2673.   Exception: if you bought the computer before 1984, the Ctrl 
  2674. key, CLEAR key, and arrow keys are located differently.
  2675.   The zero key is Swedish.
  2676.   In that diagram, one of the keys looks like this:
  2677.                                    ┌───┐
  2678.                                    │ <{│
  2679.                                    │ ,[│
  2680.                                    └───┘
  2681. If you tap that key, you'll be typing a comma. If you tap that 
  2682. key while holding down the SHIFT key, you'll be typing the symbol 
  2683. ``<''. If you tap that key while holding down the CLEAR key, 
  2684. you'll be typing the symbol ``[''. To type the remaining symbol 
  2685. on that key (the ``{''), do this: hold down the CLEAR key; while 
  2686. you keep holding down the CLEAR key, hold down the SHIFT key; 
  2687. while holding down the CLEAR and SHIFT keys, tap the key that 
  2688. shows the ``{''.
  2689.   The BACKSPACE key has a left-arrow on it; so if you tap the 
  2690. left-arrow key, the computer will erase the last character you 
  2691. typed. If you tap the left-arrow key while holding down the SHIFT 
  2692. key, the computer will erase the entire line you've been typing.
  2693.  
  2694.        Get started (page 325)
  2695.   When you flip the power switch, you create an electrical surge 
  2696. that damages any disks inside the computer. So before flipping 
  2697. the power switch, remove any disks from the computer.
  2698.   Then flip on the computer's power switch, which is
  2699. underneath the computer's right side. The red light on the bottom 
  2700. disk drive will turn on, then off.
  2701.                                          Insert a disk that 
  2702. contains ``Model 4 TRSDOS and BASIC Interpreter'' into the bottom 
  2703. drive. When you insert it, make sure the disk's label is on top 
  2704. of the disk, and make sure the disk's big oval cutout goes into 
  2705. the drive before the label does. (The Model 4P is different: the 
  2706. disk drive's slot is vertical instead of horizontal and requires 
  2707. the disk's label to be on the disk's left side.) Close the 
  2708. drive's door.
  2709.                                          On the far right side of 
  2710. the keyboard, you'll see an orange button. Press it.
  2711.                                          The computer will say 
  2712. ``Date''. If the writing looks fuzzy, turn the brightness and 
  2713. contrast dials, which are underneath the computer's left side. 
  2714. Type the date. For example, if today is January 24, 1996, type 
  2715. 01/24/96 and then press the ENTER key.
  2716.                                          The computer will say:
  2717. TRSDOS Ready
  2718.                                          Type this word:
  2719. basic
  2720. Then press the ENTER key. After a brief pause, the computer will 
  2721. say:
  2722. Ready
  2723.                                          Notice that the computer 
  2724. says ``Ready'' instead of ``OK''.
  2725.                                          Whenever you're done 
  2726. using the computer, remove any disks from the drives, before you 
  2727. flip off the power.
  2728.  
  2729.                                         What if computer gripes? (page 330)
  2730.                                          If the computer gripes 
  2731. at you, press the ENTER key immediately.
  2732.                                          After pressing the ENTER 
  2733. key, correct the error by retyping the line that the computer 
  2734. griped about.
  2735.  
  2736.                                                Arrow keys (page 332)
  2737.                                          To edit line 20, type:
  2738. edit 20
  2739.                                          If the first character 
  2740. in line 20 is correct (and doesn't need to be edited), press the 
  2741. SPACE bar. If the second character in line 20 is correct also, 
  2742. press the SPACE bar again. Press the SPACE bar for each correct 
  2743. character. Each time you press the SPACE bar, the character that 
  2744. you said was correct appears on the screen.
  2745.                                          When you get to the 
  2746. point where the next character on the screen would be incorrect, 
  2747. press the D key instead of the SPACE bar. The D key means: delete 
  2748. the next character. Pressing the D key causes the next character 
  2749. to be surrounded by backslashes, which mean the character is 
  2750. being deleted.
  2751.                                          To insert extra 
  2752. characters in the line, press the SPACE bar several times, until 
  2753. you get to where you want the characters to be inserted. Then 
  2754. press the I key (which tells the computer you want to insert). 
  2755. Then type the characters you want to insert. After typing them, 
  2756. tap the up-arrow key while holding down the SHIFT key.
  2757.                                          When you've finished all 
  2758. the deletions and insertions for that line, press the ENTER key. 
  2759. That makes the screen show the remainder of the line (the 
  2760. right-hand part of the line), and tells the computer you've 
  2761. finished editing the line.
  2762.  
  2763.                                             Clear the screen (page 333)
  2764.                                          To clear the screen by 
  2765. using the CLEAR key, tap the CLEAR key while holding down the 
  2766. SHIFT key.
  2767.       Print on paper (page 333)
  2768.   Your keyboard lacks a PRINT key. Instead of pressing a PRINT 
  2769. key, tap the colon key (which is next to the zero key) while 
  2770. holding down the CTRL key.
  2771.   Your keyboard lacks an ECHO key. Instead of pressing an ECHO 
  2772. key, type this:
  2773. system "link *do *pr"
  2774. To stop the echo, type this:
  2775. system "reset *do"
  2776.  
  2777.        Save on disk (page 336)
  2778.   If you buy a blank disk and want your computer to use it, you 
  2779. must turn the blank disk into a Radio Shack disk.
  2780.   To do that, put the blank disk into the top drive. Type:
  2781. system
  2782. format 1 (q=n)
  2783. The computer will turn the blank disk into a Radio Shack disk. 
  2784. Then the computer will say ``TRSDOS Ready''.
  2785.   Put Model 4 BASIC onto that disk, by typing:
  2786. backup :0 :1
  2787. The computer will ask whether you're sure; type the letter y. The 
  2788. computer will copy all information from the bottom disk to the 
  2789. top disk. Then the computer will say ``TRSDOS Ready'' again.
  2790.   Tell the computer you want to use BASIC now, by typing:
  2791. basic
  2792. The computer will say ``Ready''.
  2793.   FILES Instead of typing the word FILES, type this:
  2794. system "dir"
  2795. That makes the computer print a directory, showing the names of 
  2796. all the programs in all your disk drives.
  2797.   How to use drive 1 The main drive is called drive 0. The other 
  2798. drive is called drive 1.
  2799.   Normally, the computer uses drive 0. If you want JOE to be in 
  2800. drive 1 instead of drive 0, put a colon and a 1 after JOE, like 
  2801. this:
  2802. save "joe:1"
  2803.  
  2804.    How to choose a name (page 337)
  2805.   Your program's name can be short (such as JOE) or long: up to 8 
  2806. characters. The name's first character must be a letter; the 
  2807. remaining characters should be letters or digits.
  2808.  
  2809.           Tapes (page 337)
  2810.   Model 4 BASIC doesn't use tapes.
  2811.  
  2812.       FOR . . . NEXT (page 355)
  2813.   To indent you can hit the SPACE bar repeatedly. But to indent 
  2814. more easily, hit the right-arrow key once.
  2815.  
  2816.       The PAUSE key (page 367)
  2817.   Your keyboard lacks a PAUSE key.
  2818.   To make the computer pause, tap the @ key while holding down 
  2819. the SHIFT key. (Normally, pressing those keys makes the screen 
  2820. display an accent mark; but if you press those keys while a 
  2821. program is running, the computer will pause instead.)
  2822.   To stop pausing, press the SPACE bar.
  2823.                                                  LOCATE (page 371)
  2824.                                          Your computer doesn't 
  2825. understand the word LOCATE. Here's what to do instead . . . 
  2826.                                          Your computer considers 
  2827. the screen's top line to be row 0, and the line below it to be 
  2828. row 1. Your computer considers the row's leftmost character to be 
  2829. in column 0, and the next character to be in column 1.
  2830.                                          To print the word DROWN, 
  2831. so that it begins at row 3 and column 7, type this:
  2832. print@(3,7), "drown"
  2833.  
  2834.                                                  Pixels (page 372)
  2835.                                          To make Model 4 BASIC 
  2836. handle pixels, you must buy a graphics board. Read the 
  2837. instructions that come with the board.
  2838.  
  2839.                                           Advanced commands (and page #)
  2840.                                          BEEP (page 373). Your 
  2841. computer doesn't understand the word BEEP.
  2842.                                          SOUND (373). If you type 
  2843. ___ 
  2844. sound 4,10
  2845. the computer will produce a sound whose pitch is 4 and whose 
  2846. duration is 10.
  2847.                                          The pitch can be any 
  2848. integer from 0 to 7: 0=D#, 1=E, 2=F, 3=F#, 4=G, 5=A, 6=A#, 7=B. 
  2849. The duration can be any integer from 0 to 31: 0 means half a 
  2850. second; 31 means about 15 seconds.
  2851.                                          PLAY (374). Your 
  2852. computer doesn't understand the word PLAY.
  2853.                                          Exponents (384). To make 
  2854. the symbol ``^'', tap the semicolon key while holding down the 
  2855. CLEAR key.
  2856.                                          Random integers (388). 
  2857. Say RANDOM instead of RANDOMIZE.
  2858.                                          Random decimals (391). 
  2859. For a random decimal between 0 and 1, say RND(0) instead of just 
  2860. RND.
  2861.                                          Clock (395). To set the 
  2862. time to 13:45:07, say SYSTEM ``TIME 13:45:07''. To set the date 
  2863. to 01/24/1996, say SYSTEM ``DATE 01/24/1996''. Your computer 
  2864. doesn't understand TIMER.
  2865.                                          Joystick versus mouse 
  2866. (408). Your computer doesn't use a joystick or mouse.
  2867.                                          POKE (414). If you're 
  2868. using TRSDOS version 6.02, cell #2968 normally contains the 
  2869. number 95, which is the ASCII code number for an underline. That 
  2870. makes the cursor's shape be an underline.
  2871.                                          To change the cursor's 
  2872. shape, POKE a different number into cell #2968. For example, to 
  2873. change the cursor's shape to the letter A (whose ASCII code 
  2874. number is 65), say:
  2875. poke 2968,65
  2876.                                          To create a ``feminist 
  2877. computer'', turn the cursor into a female-sign (whose ASCII code 
  2878. number is 250), by saying:
  2879. poke 2968,250
  2880.                                          Older versions of 
  2881. TRSDOS. Cell #2968 does that only in TRSDOS version 6.2. Instead 
  2882. of cell #2968, version 6.00 uses cell #3040; version 6.01 uses 
  2883. cell #3017.
  2884.                                          When you turn on the 
  2885. computer, versions 6.00 and 6.01 begin by making the cursor be a 
  2886. double-underline (whose ASCII code is 176) instead of a 
  2887. single-underline.
  2888.                                          OPEN FOR OUTPUT (415). 
  2889. Instead of saying OPEN ``SUE'' FOR OUTPUT AS 1, say OPEN 
  2890. ``O'',1,``SUE''. In the quotation marks, be sure to put the 
  2891. letter O, not a zero.
  2892.                                          OPEN FOR INPUT (415). 
  2893. Instead of saying OPEN ``SUE'' FOR INPUT AS 1, say OPEN 
  2894. ``I'',1,``SUE''.
  2895.                                          OPEN FOR APPEND (415). 
  2896. Instead of saying OPEN ``SUE'' FOR APPEND AS 1, say OPEN 
  2897. ``E'',1,``SUE''. The ``E'' tells the computer to Extend the file.
  2898.                                          LOF (416). Your computer 
  2899. doesn't understand the usual meaning of LOF(1).
  2900.                                          PUT (417). Instead of 
  2901. saying OPEN ``JIM'' AS 1 LEN=20, say OPEN ``R'',1,``JIM'',20.
  2902.                                          End of the file (417). 
  2903. LOF(1) is the number of records in the file (instead of being the 
  2904. number of bytes).
  2905.  
  2906.  
  2907.               TANDY COLOR COMPUTER
  2908.   Here's how to use BASIC on Tandy's Radio Shack TRS-80 Color 
  2909. Computer 2. (The Color Computer 1, Color Computer 3, and Micro 
  2910. Color Computer are similar.)
  2911.  
  2912.            Microsoft BASIC (page 322)
  2913.   When you buy the Color Computer 2, make sure you get extended 
  2914. color BASIC, not standard color BASIC (which costs less but is 
  2915. crummy). The following comments apply to extended color BASIC.
  2916.  
  2917.              The keyboard (page 324)
  2918.   The keys are placed like this:
  2919.   ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┬───┬───┬─────┐
  2920.   │ ! │ " │ # │ $ │ % │ & │ ' │ ( │ ) │Revrs│ * │ = │     │
  2921.   │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │  0  │ : │ - │Break│
  2922. ┌─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┼───┴─┬─┴───┬─┴─┐
  2923. │   │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │Pause│DelLn│ ] │
  2924. │  │   │   │   │   │   │   │   │   │   │   │  @  │    │ ■ │
  2925. └┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬────┴──┬──┴──┬┘
  2926.  │ [ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ + │       │  \  │
  2927.  │  │   │   │   │   │   │   │   │   │   │ ; │ Enter │Clear│
  2928.  ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┴─┬───┘
  2929.  │     │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │       │
  2930.  │Shift│   │   │   │   │   │   │   │ , │ . │ / │ Shift │
  2931.  └─────┴───┴─┬─┴───┴───┴───┴───┴───┴───┴───┼───┴───────┘
  2932.              │                             │
  2933.              │            Space            │
  2934.              └─────────────────────────────┘
  2935.   The computer capitalizes all letters automatically; so to type 
  2936. a capital letter, do not press the SHIFT key.
  2937.   There is no CAPS key.
  2938.   The BACKSPACE key has a left-arrow on it; so if you tap the 
  2939. left-arrow key, the computer will erase the last character you 
  2940. typed. If you tap the left-arrow key while holding down the SHIFT 
  2941. key, the computer will erase the entire line you've been typing.
  2942.  
  2943.              Get started (page 325)
  2944.   Attach the computer to a TV. Turn on the computer's power, by 
  2945. pressing the POWER button, which is at the computer's rear. Turn 
  2946. on the TV, and turn it to channel 3 or 4. To switch the computer 
  2947. from channel 3 to channel 4 or back to channel 3, flip your 
  2948. computer's channel-selection switch, which is at the computer's 
  2949. rear. When the computer's on and functioning correctly, the 
  2950. computer will say OK.
  2951.  
  2952.            Ranges of lines (page 332)
  2953.   Say DEL instead of DELETE.
  2954.                                                      Arrow keys (page 332)
  2955.                                                      To edit line 
  2956. 20, type:
  2957. EDIT 20
  2958.                                                      If the first 
  2959. character in line 20 is correct (and doesn't need to be edited), 
  2960. press the SPACE bar. If the second character in line 20 is 
  2961. correct also, press the SPACE bar again. Press the SPACE bar for 
  2962. each correct character. Each time you press the SPACE bar, the 
  2963. character that you said was correct appears on the screen.
  2964.                                                      When you get 
  2965. to the point where the next character on the screen would be 
  2966. incorrect, press the D key instead of the SPACE bar. The D key 
  2967. means: delete the next character. Pressing the D key prevents the 
  2968. next character from appearing on the screen.
  2969.                                                      To insert 
  2970. extra characters in the line, press the SPACE bar several times, 
  2971. until you get where you want the characters to be inserted. Then 
  2972. press the I key (which tells the computer you want to insert). 
  2973. Then type the characters you want to insert. After typing them, 
  2974. tap the up-arrow key while holding down the SHIFT key.
  2975.                                                      When you've 
  2976. finished all the deletions and insertions for that line, press 
  2977. the ENTER key. That makes the screen show the remainder of the 
  2978. line (the right-hand part of the line), and tells the computer 
  2979. you've finished editing the line.
  2980.  
  2981.                                                    Print on paper (page 333)
  2982.                                                      Your 
  2983. keyboard doesn't have a PRINT key or an ECHO key. Instead of 
  2984. saying ``LPRINT'' say ``PRINT#-2,''. For example, to print ``I 
  2985. LOVE YOU'' on paper, type this:
  2986. PRINT #-2, "I LOVE YOU"
  2987.                                                      Even though 
  2988. the computer doesn't understand ``LPRINT'', it does understand 
  2989. ``LLIST''.
  2990.        Save on disk (page 336)
  2991.   When you flip the disk drive's power switch, you create an 
  2992. electrical surge that damages any disk inside the drive. So 
  2993. before flipping the drive's power switch, make sure the drive is 
  2994. empty.
  2995.   When you're done using the computer, remove any disk from the 
  2996. drive, before you flip off the power.
  2997.   How to insert a disk To put a disk into the drive, open the 
  2998. drive's door, then insert the disk into the drive. When you 
  2999. insert it, make sure the disk's label is on top of the disk, and 
  3000. make sure the disk's big oval cutout goes into the drive before 
  3001. the label does. Close the drive's door.
  3002.   (Exception: if your drive was made before 1985, the drive's 
  3003. slit is vertical instead of horizontal, and the disk's label is 
  3004. on the left side of the disk instead of the top.)
  3005.   How to turn a blank disk into a Radio Shack disk If you buy a 
  3006. blank disk and want your computer to use it, you must turn the 
  3007. blank disk into a Radio Shack disk.
  3008.   To do that, insert the blank disk into the drive (and close the 
  3009. door). Then type DSKINI0. (That last character is a zero, not the 
  3010. letter O.)
  3011.   The disk drive's red light will glow for 40 seconds. When the 
  3012. light stops glowing, the computer will say OK.
  3013.   FILES Instead of saying FILES, say DIR (which stands for 
  3014. ``directory'').
  3015.   How to use drive 1 The main drive is called drive 0. If you 
  3016. have an extra drive, that extra is called drive 1.
  3017.   Normally, the computer uses drive 0. If you want JOE to be in 
  3018. drive 1 instead of drive 0, put a colon and a 1 after JOE, like 
  3019. this:
  3020. SAVE "JOE:1"
  3021.   To make the computer print the names of all the programs in 
  3022. drive 1, type this:
  3023. DIR 1
  3024.  
  3025.    How to choose a name (page 337)
  3026.   Your program's name can be short (such as JOE) or long: up to 8 
  3027. characters. the name's first character must be a letter; the 
  3028. remaining characters should be letters or digits.
  3029.  
  3030.       Edit the disk (page 337)
  3031.   Instead of saying RENAME ``JOE'' to ``FRED'', say RENAME 
  3032. ``JOE/BAS'' to ``FRED/BAS'', to emphasize that JOE was written in 
  3033. BASIC.
  3034.  
  3035.     Space on the disk (page 337)
  3036.   Instead of saying KILL ``JOE'', say KILL ``JOE/BAS''.
  3037.                                                  Tapes (page 337)
  3038.                                          To copy a program onto a 
  3039. tape, position the tape and notice the counter's number. Then 
  3040. press the recorder's RECORD and PLAY buttons at the same time as 
  3041. each other. Type this:
  3042. CSAVE "A"
  3043. The computer will copy the program onto tape and then say OK. 
  3044. Press the recorder's STOP button.
  3045.                                          How to read a program 
  3046. from a tape Put the tape into the recorder. (To do that, you 
  3047. might have to press the recorder's EJECT button.)
  3048.                                          Type the word CLOAD.
  3049.                                          Press the recorder's 
  3050. REWIND button. When the tape is rewound, press the recorder's 
  3051. STOP button. Push the counter's button, so the counter becomes 
  3052. zero.
  3053.                                          Press the recorder's 
  3054. FAST FORWARD button. Look at the counter. When the number on the 
  3055. counter is almost up to the number of the program's beginning, 
  3056. press the recorder's STOP button.
  3057.                                          Press the recorder's 
  3058. PLAY button. The computer will search on the tape for the 
  3059. beginning of the program. When the computer reaches the beginning 
  3060. of the program, the computer will print an F.
  3061.                                          Then the computer begins 
  3062. reading the program. When the computer finishes reading it, the 
  3063. computer will say OK.
  3064.                                          Press the recorder's 
  3065. STOP button. Type the word LIST or RUN.
  3066.  
  3067.                                           Long variable names (page 340)
  3068.                                          Variable names must be 
  3069. short. The name of a numeric variable must be just 1 or 2 
  3070. characters: the name of a string variable must be just 1 or 2 
  3071. characters followed by a dollar sign. If you try to make the 
  3072. variable's name longer than that, the computer will handle it 
  3073. unreliably.
  3074.                                          If you want a variable 
  3075. name that's 2 characters long, avoid the following 2-character 
  3076. names, which have special meanings: GO, TO, IF, ON, FN, OR.
  3077.  
  3078.                                                  INPUT (page 341)
  3079.                                          For some of the programs 
  3080. that involve string input, the computer will gripe about being 
  3081. ``out of string space''; the computer will say:
  3082. ?OS ERROR
  3083.                                          To stop the computer 
  3084. from griping, insert this statement:
  3085. 1 CLEAR 1000
  3086. If the computer still says OS ERROR, raise 1000 to a higher 
  3087. number, like this:
  3088. 1 CLEAR 2000
  3089. Keep raising, until the computer stops that gripe. On the other 
  3090. hand, if you raise too high, the computer will say ___ 
  3091. ?OM ERROR
  3092. That means you must go lower.
  3093.                                          So if the computer says 
  3094. ``OS ERROR'', you should raise the CLEAR number; if the computer 
  3095. says ``OM ERROR'', you should lower the CLEAR number.
  3096.                                          Here's why. . . . 
  3097.   Your program contains two kinds of strings: the strings that 
  3098. are known, and the strings that are unknown. For example, if you 
  3099. say ___ 
  3100. 10 G$="DOWN"
  3101. the G$ is known to be DOWN. If you say ___ 
  3102. 10 INPUT "WHAT IS YOUR NAME";N$
  3103. the N$ is unknown, because its value depends on what the human 
  3104. inputs.
  3105.   Normally, the computer reserves enough memory space to hold 
  3106. just 200 unknown characters. If your program needs more 
  3107. characters than that ___ for example, if your program inputs 7 
  3108. strings, each having 30 characters, so that the total number of 
  3109. characters is 210 ___ the computer will gripe, and say ``out of 
  3110. string space error'' (OS ERROR).
  3111.   If you say ___ 
  3112. 1 CLEAR 1000
  3113. the computer will reserve enough space to hold 1000 unknown 
  3114. characters, instead of the normal quantity (which is just 200).
  3115.   How much space can you reserve? That depends on how much memory 
  3116. you bought for your computer. If your computer has little memory, 
  3117. and you try to reserve more space than your computer has, the 
  3118. computer will give up, and say ``out of memory error'' (OM 
  3119. ERROR).
  3120.  
  3121.       FOR . . . NEXT (page 355)
  3122.   If you indent the lines between FOR and NEXT, your computer 
  3123. ignores the indentation. When you LIST your program, you won't 
  3124. see any indentations. So don't bother to indent.
  3125.  
  3126.       The PAUSE key (page 367)
  3127.   To make the computer pause, hold down the SHIFT key; and while 
  3128. you keep holding down the SHIFT key, tap the @ key.
  3129.   To stop pausing, press the SPACE bar.
  3130.  
  3131.           Zones (page 368)
  3132.   Each zone is 16 characters wide. Your screen has just 2 zones, 
  3133. so your screen is 32 characters wide.
  3134.  
  3135.            TAB (page 370)
  3136.   On other computers, the leftmost character in the line is said 
  3137. to be at position 1. But on your computer, the leftmost character 
  3138. in the line is said to be at position 0 instead; after position 0 
  3139. come positions 1, 2, 3, etc.
  3140.   So on your computer, if you say TAB(0), you'll be going to the 
  3141. leftmost position; if you say TAB(1), you will not be going to 
  3142. the leftmost position.
  3143.  
  3144.           LOCATE (page 371)
  3145.   Your computer doesn't understand the word LOCATE. Here's what 
  3146. to do instead . . . 
  3147.   Your computer considers the screen's top line to be row 0, and 
  3148. the line below it to be row 1. Your computer considers the row's 
  3149. leftmost character to be in column 0, and the next character to 
  3150. be in column 1.
  3151.   To print the word DROWN, so that it begins at row 3 and column 
  3152. 7, type this:
  3153. PRINT@32* 3+7, "DROWN"
  3154.  
  3155.                                                  Pixels (page 372)
  3156.                                          To use pixels, type 
  3157. these lines:
  3158. 10 PMODE 4: PCLS: SCREEN 1
  3159. 10000 GO TO 10000
  3160.                                          Line 10 warns the 
  3161. computer that you want to use pixels. (In that line, the PMODE 4 
  3162. makes the X coordinate go from 0 to 255 and the Y coordinate go 
  3163. from 0 to 191. The PCLS makes the graphic screen begin by being 
  3164. blank. The SCREEN 1 makes the computer show you the graphics 
  3165. instead of text.)
  3166.                                          Line 10000, at the 
  3167. bottom of your program, makes the computer pause, so that you can 
  3168. admire whatever graphics have been drawn.
  3169.                                          Between lines 10 and 
  3170. 10000, you can insert lines containing the following commands. . 
  3171. . . 
  3172.                                          To draw a dot at pixel 
  3173. (100,100), say PSET (100,100).
  3174.                                          To draw a line from 
  3175. pixel (0,0) to pixel (100,100), say LINE (0,0)-(100,100),PSET.
  3176.                                          To draw a box 
  3177. (``rectangle'') that has a corner at pixel (0,0) and has an 
  3178. opposite corner at pixel (100,100), say LINE 
  3179. (0,0)-100,100),PSET,B.
  3180.                                          To draw a box that has a 
  3181. corner at (0,0) and an opposite corner at (100,100), and also 
  3182. make the computer fill in the box (i.e., paint the box's 
  3183. interior), say LINE (0,0)-(100,100),PSET,BF.
  3184.                                          Each of those commands 
  3185. contains the word PSET. To erase the shape that you drew, give 
  3186. the same command again, but replace the PSET by PRESET.
  3187.                                          To draw a circle 
  3188. centered at pixel (100,100), and to make the circle's radius be 
  3189. 50, say CIRCLE (100,100),50. To erase that circle, say CIRCLE 
  3190. (100,100),50,0.
  3191.                                          To paint the inside of 
  3192. any shape (such as a circle or a person), say PAINT and mention a 
  3193. point inside the shape. For example, to fill in an outline that 
  3194. has (101,101) inside it, say PAINT (101,101). To erase that paint 
  3195. (and also the shape itself), say PAINT (101,101),0.
  3196.                                          To erase the entire 
  3197. drawing (``clear the screen''), say PCLS.
  3198.                                          If you say SCREEN 0, the 
  3199. screen will stop showing graphics (and will show text instead), 
  3200. until you say SCREEN 1 (which brings back the graphics).
  3201.                                          To get started 
  3202. experimenting with all those commands, run the following program; 
  3203. it draws a line from (0,0) to (100,100) and then draws a circle 
  3204. centered at pixel (100,100) and with radius 50:
  3205. 10 PMODE 4: PCLS: SCREEN 1
  3206. 20 LINE (0,0)-(100,100)
  3207. 30 CIRCLE (100,100),50
  3208. 10000 GO TO 10000
  3209. The computer draws the shapes in green, on a black background. 
  3210. After you've admired the pretty picture, abort the program by 
  3211. pressing the BREAK key.
  3212.                                          Colors To get colors, 
  3213. line 10 must say PMODE 3 instead of PMODE 4.
  3214.                                          After you've said PMODE 
  3215. 3, whenever the computer draws (or erases) a pixel, it does the 
  3216. same thing to the pixel next to it. Specifically, if you tell the 
  3217. computer to draw (or erase) a pixel whose X coordinate is even, 
  3218. the computer will do the same thing to the pixel at its right 
  3219. (whose X coordinate is odd). If you tell the computer to draw (or 
  3220. erase) a pixel whose X coordinate is odd, the computer will do 
  3221. the same thing to the pixel at its left (whose X coordinate is 
  3222. even).
  3223.                                          After you've said PMODE 
  3224. 3, the computer normally draws red shapes on a green background. 
  3225. But if you don't like those colors, you can pick different colors 
  3226. instead.
  3227.   To choose different colors, use these code numbers: 1=green, 
  3228. 2=yellow, 3=blue, and 4=red. For example, to draw yellow shapes 
  3229. on a blue background, say COLOR 2,3. the traditional place to say 
  3230. COLOR 2,3 is in line 10, like this:
  3231. 10 PMODE 3: COLOR 2,3: PCLS: SCREEN 1
  3232.   If you prefer, you can say COLOR 2,3 later in your program 
  3233. instead. If you say it later, the shapes at the beginning of your 
  3234. program will be unaffected by that COLOR statement. When you draw 
  3235. new shapes after giving that COLOR statement, the shapes that 
  3236. were already on the screen (in their old colors) remain 
  3237. unchanged; they keep their original colors.
  3238.   When you say PRESET (in the middle of a dot or line or box 
  3239. command), the computer assumes you want the shape erased; to 
  3240. erase the shape, the computer redraws the shape by using the 
  3241. background color. If you recently changed the background color 
  3242. (by saying COLOR), the erasure will be done by using the new 
  3243. background color, which won't match the old background color.
  3244.   If you say CIRCLE (100,100),50,2 the computer will draw the 
  3245. circle in yellow (because the 2 at the end of the CIRCLE command 
  3246. is the code number for yellow). Do not put a 0 at the end of the 
  3247. CIRCLE command, since 0 is not an acceptable color number. You 
  3248. must pick a number from 1 to 4.
  3249.   If you say PAINT, you must say which pixel to start painting 
  3250. at; you must say which color paint to use; and you must remind 
  3251. the computer of what color the outline had that you're filling 
  3252. in. For example, if you want the computer to paint starting at 
  3253. pixel (101,101) ___ which is inside the outline ___ and you want 
  3254. the computer to use yellow paint (whose code number is 2), and 
  3255. the outline that you're filling in was drawn in blue (whose code 
  3256. number is 3), say PAINT (101,101),2,3.
  3257.   Near the end of your program, if you say SCREEN 1,1, you'll see 
  3258. a ``negative'' of your picture. In the ``negative'', green 
  3259. becomes light blue (even though Radio Shack's manual incorrectly 
  3260. says it becomes ``buff''), yellow becomes cyan (greenish blue), 
  3261. blue becomes magenta (purplish red), and red becomes orange. All 
  3262. future drawings (even by other programs) will be done using those 
  3263. ``negative'' colors, unless you tell the computer to return to a 
  3264. ``positive'', by saying SCREEN 1,0.
  3265.  
  3266.    Advanced commands (and page #)
  3267.   BEEP (page 373). Your computer doesn't understand the word 
  3268. BEEP.
  3269.   SOUND (373). If you type ___ 
  3270. SOUND 100,15
  3271. the computer will produce a sound whose pitch is 100. You can 
  3272. choose any pitch from 1 to 255.
  3273.   In that example, the 15 makes the computer produce the sound 
  3274. for 1 second. If you want the sound to last longer ___ so that 
  3275. its lasts 2 seconds ___ replace the 15 by 15*2. For 10 seconds, 
  3276. say 15*10. (That's because your computer's metronome beats 15 
  3277. times per second.)
  3278.   PLAY (374). Your computer handles the PLAY command slightly 
  3279. differently than other computers.
  3280.   Your computer can't play octaves 0 or 6: it plays just octaves 
  3281. 1 through 5. If you don't specify an octave, the computer will 
  3282. play in octave 2.
  3283.   To create a dotted eighth note, put a dot after the 8 instead 
  3284. of after the note's name. For example, to make E be a dotted 
  3285. eighth note, say ``L8.E''.
  3286.   If you say PLAY ``T1'', the computer will play 56 quarter notes 
  3287. per minute, which is very slow (largo). If you say PLAY ``T2'', 
  3288. the computer will play twice as fast: 112 quarter notes per 
  3289. minute (moderato). If you say PLAY ``T3'', the computer will play 
  3290. three times as fast: 168 quarter notes per minute (vivace). You 
  3291. can pick speeds up to PLAY ``T255'', which is ridiculously fast! 
  3292. If you don't specify a tempo, the computer will play at speed T2, 
  3293. which is 112 quarter notes per minute (moderato).
  3294.                                          Normally, the computer 
  3295. plays at volume 15; but you can change the volume. To switch to 
  3296. volume 4 (which is lower, quieter), say:
  3297. PLAY "V4"
  3298. You can switch to any volume from 1 to 31.
  3299.                                          If you try the bottom 
  3300. example in the main text, slow down the tempo: change T150 to T2.
  3301.                                          Exponents (384). For 
  3302. exponents, the TRS-80 Color Computer 2 (with extended color 
  3303. BASIC) uses the symbol ``'' instead of ``^''.
  3304.                                          Random integers (388). 
  3305. Omit the word RANDOMIZE.
  3306.                                          Random decimals (391). 
  3307. For a random decimal between 0 and 1, say RND(0) instead of RND.
  3308.                                          Clock (395). Your 
  3309. computer doesn't understand TIME$ or DATE$.
  3310.                                          Here's how to use the 
  3311. TIMER function. First, reset the TIMER to zero, by saying 
  3312. TIMER=0. Later, whenever you say PRINT TIMER/60, the computer 
  3313. will tell you how many seconds ago the timer was reset.
  3314.                                          Unfortunately, the TIMER 
  3315. lasts only 18 minutes; after 18 minutes, it resets itself to zero 
  3316. again.
  3317.                                          Types of numbers (397). 
  3318. All variables are reals: you can't create integer variables or 
  3319. double-precision variables.
  3320.                                          To create a real number, 
  3321. you can type as many digits as you wish, but the computer 
  3322. remembers just the first 10 digits accurately, and prints just 
  3323. the first 9 of them on your screen.
  3324.                                          RAM consumption (397). 
  3325. Each real number consumes 5 bytes of RAM.
  3326.                                          Omitting the question 
  3327. mark (406). In the INPUT statement, you can't replace the 
  3328. semicolon by a comma.
  3329.                                          Adjacent printing (407). 
  3330. You can't put a semicolon immediately after INPUT.
  3331.                                          INPUT$ (407). Instead of 
  3332. saying ___ 
  3333. 20 A$=INPUT$(1)
  3334. say:
  3335. 20 A$=INKEY$: IF A$="" THEN GO TO 20
  3336.                                          Instead of saying 
  3337. INPUT$(4), you must INKEY$ one character at a time.
  3338.                                          Joystick (408). Say 
  3339. JOYSTK instead of STICK. The coordinates of the right joystick 
  3340. are JOYSTK(0) and JOYSTK(1). The coordinates of the left joystick 
  3341. are JOYSTK(2) and JOYSTK(3).
  3342.                                          When the computer comes 
  3343. to a line that mentions JOYSTK(0), the computer looks at both 
  3344. joysticks and computes JOYSTK(0), JOYSTK(1), JOYSTK(2), and 
  3345. JOYSTK(3). If your program mentions JOYSTK(1) or JOYSTK(2) or 
  3346. JOYSTK(3), without mentioning JOYSTK(0), the computer won't look 
  3347. at the joysticks.
  3348.                                          Mouse (408). Your 
  3349. computer's version of BASIC is not designed to work with a mouse.
  3350.                                          SWAP (409). Your 
  3351. computer doesn't understand SWAP, so use the alternative.
  3352.                                          ON ERROR GO TO (414). 
  3353. Your computer doesn't understand ON ERROR GO TO.
  3354.                                          OPEN FOR OUTPUT (415). 
  3355. Instead of saying OPEN ``SUE'' FOR OUTPUT AS 1, say OPEN 
  3356. ``O'',1,``SUE''. In the quotation marks, be sure to put the 
  3357. letter O, not a zero.
  3358.                                          OPEN FOR INPUT (415). 
  3359. Instead of saying OPEN ``SUE'' FOR INPUT AS 1, say OPEN 
  3360. ``I'',1,``SUE''.
  3361.                                          OPEN FOR APPEND (415). 
  3362. Your computer doesn't understand APPEND.
  3363.                                          LOF (416). Your computer 
  3364. doesn't understand the usual meaning of LOF(1).
  3365.                                          PUT (417). Instead of 
  3366. saying OPEN ``JIM'' AS 1 LEN=20, say OPEN ``D'',1,``JIM'',20.
  3367.                                          End of the file (417). 
  3368. LOF(1) is the number of records in the file (instead of being the 
  3369. number of bytes).
  3370.                                          Numerical data (417). 
  3371. Instead of using MKI$, MKS$, or MKD$, use MKN$. It MaKes a Number 
  3372. into a 5-byte string.
  3373.                                          Instead of using CVI, 
  3374. CVS, or CVD, use CVN. It ConVerts a 5-byte string to a Number.
  3375.  
  3376.  
  3377.            OTHER COMPUTERS
  3378.   Here's how to use BASIC on other kinds of computers.
  3379.  
  3380.                 Tandy
  3381.   On page 443, I explained how to use BASIC on the TRS-80 Model 4 
  3382. (and Model 4D and Model 4P).
  3383.   On page 445, I explained how to use BASIC on the TRS-80 Color 
  3384. Computer 2 (and Color Computer 1, Color Computer 3, and Micro 
  3385. Color Computer).
  3386.   If your computer is numbered between 1000 and 5000 (such as the 
  3387. Tandy 1000, 1200, 1400, 2000, 3000, 4000, or 5000), it's an IBM 
  3388. PC clone (explained on page 422).
  3389.   Here's how to use the TRS-80 Model 3. (Models 1, 2, 12, 16, 
  3390. 100, 102, 200, 6000, and Pocket Computers are similar.)
  3391.   The keyboard. Similar to Color Computer. You cannot create the 
  3392. symbols ``['', ``]'', and ``\'' by holding down the SHIFT key. To 
  3393. create the symbol ``['', tap the up-arrow key. To switch to lower 
  3394. case, tap the zero key while holding down the SHIFT key.
  3395.   Get started, if you don't have a disk. While holding down the 
  3396. BREAK key, flip on the power switch, which is underneath the 
  3397. computer's right side. The computer will say ``Cass''. If the 
  3398. writing looks fuzzy, turn the brightness and contrast dials, 
  3399. which are underneath the computer's left side. Press the ENTER 
  3400. key. The computer will say ``Memory Size''. Press ENTER again. 
  3401. The computer will say READY.
  3402.   Get started, if you have a disk. Follow Model 4's procedure, 
  3403. with these exceptions. . . . The disk you insert contains ``Model 
  3404. 3 TRSDOS'' instead of ``Model 4 TRSDOS''. After you enter the 
  3405. date (and press the ENTER key), the computer will say ``Enter 
  3406. Time''. Type the time by using a 24-hour clock; for example, if 
  3407. the time is 1:45 PM, type 13:45:00 and press ENTER. The computer 
  3408. will say ``How Many Files''; press ENTER. The computer will say 
  3409. ``Memory Size''; press ENTER. Then the computer will say READY.
  3410.   What if the computer gripes? Same as Model 4.
  3411.   Arrow keys. Similar to Model 4. When you press the D key, the 
  3412. character will be surrounded by exclamation points instead of 
  3413. backslashes.
  3414.   Print on paper. Your computer lacks a PRINT key. Instead of 
  3415. pressing a PRINT key, do the following: while depressing the 
  3416. down-arrow key and left SHIFT key simultaneously, tap the colon 
  3417. key.
  3418.   Your computer lacks an ECHO key. If you're using a disk, you 
  3419. can turn the echo on by typing this ___ 
  3420. CMD "Z","ON"
  3421. and turn the echo off by typing this:
  3422. CMD "Z","OFF"
  3423.   Save on disk. Similar to Model 4. To make the computer print 
  3424. the names of all programs on disk 0, say:
  3425. CMD "D:0"
  3426. To make the computer print the names of all programs on disk 1, 
  3427. say:
  3428. CMD "D:1"
  3429. Do not say FILES or SYSTEM ``DIR''.
  3430.   To turn a blank disk into a Radio Shack disk, do not say 
  3431. SYSTEM, etc. Instead, put the blank disk into the top drive, and 
  3432. then say:
  3433. CMD "S"
  3434. BACKUP :0 :1
  3435. The computer will ask, ``Source Disk Master Password?'' Type the 
  3436. word PASSWORD. The computer will copy all information from the 
  3437. bottom drive's disk to the blank disk. The computer will say 
  3438. ``TRSDOS Ready''. Type the word BASIC. The computer will say 
  3439. ``How Many Files''. Press the ENTER key. The computer will say 
  3440. ``Memory Size''. Press the ENTER key. The computer will say 
  3441. READY.
  3442.   How to choose a name. Same as Model 4.
  3443.   Tapes. Similar to Color Computer. The computer will say READY 
  3444. instead of OK, and will print a pair of asterisks instead of an 
  3445. F. The right asterisk flashes.
  3446.   Long variable names. Same as Color Computer.
  3447.   INPUT. Similar to Color Computer. If you're using a disk, the 
  3448. computer says ``Out of string space'' instead of ``?OS ERROR'', 
  3449. and says ``Out of memory'' instead of ``?OM ERROR''. If you don't 
  3450. say CLEAR, the computer reserves enough memory space to hold just 
  3451. 50 unknown characters.
  3452.                                          FOR...NEXT. Same as 
  3453. Model 4.
  3454.                                          Renumbering. To 
  3455. renumber, you must be using disks, and you must say NAME instead 
  3456. of RENUM.
  3457.                                          PAUSE key. To pause (or 
  3458. stop pausing), tap the @ key while holding down the SHIFT key.
  3459.                                          Zones. Each zone is 16 
  3460. characters wide. Your screen has just 4 zones, so your screen is 
  3461. 64 characters wide.
  3462.                                          TAB. Same as Color 
  3463. Computer.
  3464.                                          LOCATE. Similar to Color 
  3465. Computer. Say 64 instead of 32.
  3466.                                          Pixels. The X coordinate 
  3467. goes from 0 to 127. The Y coordinate goes from 0 to 47. Say SET 
  3468. instead of PLOT. Your computer doesn't understand LINE, CIRCLE, 
  3469. PAINT, or colors.
  3470.                                          Sounds. Your computer 
  3471. can't produce sounds.
  3472.                                          Exponents. Instead of 
  3473. typing the symbol ``^'', type the symbol ``['', by pressing the 
  3474. up-arrow key.
  3475.                                          Random integers, 
  3476. decimals. Same as Model 4.
  3477.                                          Clock. To set the date 
  3478. to 01-24-1996, say:
  3479. POKE 16924,1: POKE 16923,24: POKE 16922,96
  3480. To set the time to 13:45:07, say:
  3481. POKE 16921,13: POKE 16920,45: POKE 16919,7
  3482. If you say PRINT TIME$, the computer will print both the date and 
  3483. time. Your computer doesn't understand TIMER.
  3484.                                          POKE. Same as Model 4, 
  3485. but uses cell #16419 instead of #2968, and normally makes the 
  3486. cursor be a double-underline (ASCII 176) instead of a 
  3487. single-underline.
  3488.                                          Omitting the question 
  3489. mark, adjacent printing, INPUT$. Same as Color Computer.
  3490.                                          Joystick. Your computer 
  3491. doesn't use joysticks.
  3492.                                          SWAP. Your computer 
  3493. doesn't understand SWAP, so use the alternative.
  3494.                                          OPEN FOR OUTPUT, INPUT, 
  3495. APPEND, LOF, PUT, end of the file. Same as Model 4.
  3496.  
  3497.                                                      Laser 128
  3498.                                          The Laser 128 computer 
  3499. imitates the Apple 2c (which is explained on page 431).
  3500.  
  3501.                                                    Franklin Ace
  3502.                                          The Franklin Ace 
  3503. computer imitates the Apple 2+ (which is explained on page 431).
  3504.  
  3505.                                                     Coleco Adam
  3506.                                          The Adam computer, 
  3507. manufactured by Coleco, resembles the Apple 2+ (which is 
  3508. explained on page 431). For a list of ways in which the Adam 
  3509. computer differs from the Apple 2+, get an earlier edition of The 
  3510. Secret Guide to Computers by phoning me at 617-666-2666.
  3511.  
  3512.                                               Computers that use CP/M
  3513.                                          The CP/M operating 
  3514. system is used by many old computers, such as the Kaypro 2, 
  3515. Kaypro 2X, Kaypro 4, Kaypro 10, and old relics manufactured by 
  3516. Osborne, Morrow, Cromemco, Vector, North Star, Xerox, and Zorba.
  3517.                                          On CP/M computers, begin 
  3518. by learning MBASIC (which is also called Microsoft BASIC and 
  3519. BASIC-80), since that version of BASIC is the easiest to learn. 
  3520. It resembles Tandy Model 4 BASIC (which is explained on page 
  3521. 443). For more details, get an earlier edition of The Secret 
  3522. Guide to Computers by phoning me at 617-666-2666.
  3523.  
  3524.                                       Atari, Texas Instruments, TimexSinclair
  3525.                                          For details, get an 
  3526. earlier edition of The Secret Guide to Computers by phoning me at 
  3527. 617-666-2666.